StefanPetrick / animartrix

High fidelity & high-res LED animations for microcontrollers with hardware FPU (Teensy 4.x, 3.5, 3.6 & ESP32 S3)
https://www.youtube.com/@stefanpetrick
58 stars 8 forks source link

Compile errors on ESP32 #26

Open moose4lord opened 2 days ago

moose4lord commented 2 days ago

Hello, I'm trying to get your LED animation code to run on an ESP32 and it is throwing these compile time errors:

/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:26:37: error: 'float lerp(float, float, float)' conflicts with a previous declaration
   26 | float lerp(float t, float a, float b){ return a + t * (b - a); }
      |                                     ^
In file included from /Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/math.h:36,
                 from /Users/klord/Library/Arduino15/packages/esp32/hardware/esp32/3.0.7/cores/esp32/esp32-hal.h:30,
                 from /Users/klord/Library/Arduino15/packages/esp32/hardware/esp32/3.0.7/cores/esp32/Arduino.h:36,
                 from /private/var/folders/30/7r5xxxjj07xcrm3sb5gmt0th0000gn/T/arduino/sketches/8C0EDF3538BAAE31F232DB0AD2124341/sketch/ANIMartRIX.ino.cpp:1:
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1911:3: note: previous declaration 'constexpr float std::lerp(float, float, float)'
 1911 |   lerp(float __a, float __b, float __t) noexcept
      |   ^~~~
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino: In function 'float pnoise(float, float, float)':
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:55:26: error: call of overloaded 'lerp(float&, float, float)' is ambiguous
   55 | return lerp(w,lerp(v,lerp(u, grad(P(AA  ), x, y, z),    /* AND ADD */
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                           grad(P(BA  ), x-1, y, z)),    /* BLENDED */
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1919:3: note: candidate: 'constexpr long double std::lerp(long double, long double, long double)'
 1919 |   lerp(long double __a, long double __b, long double __t) noexcept
      |   ^~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1915:3: note: candidate: 'constexpr double std::lerp(double, double, double)'
 1915 |   lerp(double __a, double __b, double __t) noexcept
      |   ^~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1911:3: note: candidate: 'constexpr float std::lerp(float, float, float)'
 1911 |   lerp(float __a, float __b, float __t) noexcept
      |   ^~~~
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:26:7: note: candidate: 'float lerp(float, float, float)'
   26 | float lerp(float t, float a, float b){ return a + t * (b - a); }
      |       ^~~~
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:57:19: error: call of overloaded 'lerp(float&, float, float)' is ambiguous
   57 |               lerp(u, grad(P(AB  ), x, y-1, z),         /* RESULTS */
      |               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   58 |                    grad(P(BB  ), x-1, y-1, z))),        /* FROM  8 */
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1919:3: note: candidate: 'constexpr long double std::lerp(long double, long double, long double)'
 1919 |   lerp(long double __a, long double __b, long double __t) noexcept
      |   ^~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1915:3: note: candidate: 'constexpr double std::lerp(double, double, double)'
 1915 |   lerp(double __a, double __b, double __t) noexcept
      |   ^~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1911:3: note: candidate: 'constexpr float std::lerp(float, float, float)'
 1911 |   lerp(float __a, float __b, float __t) noexcept
      |   ^~~~
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:26:7: note: candidate: 'float lerp(float, float, float)'
   26 | float lerp(float t, float a, float b){ return a + t * (b - a); }
      |       ^~~~
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:59:25: error: call of overloaded 'lerp(float&, float, float)' is ambiguous
   59 |             lerp(v, lerp(u, grad(P(AA+1), x, y, z-1),   /* CORNERS */
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   60 |                  grad(P(BA+1), x-1, y, z-1)),           /* OF CUBE */
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1919:3: note: candidate: 'constexpr long double std::lerp(long double, long double, long double)'
 1919 |   lerp(long double __a, long double __b, long double __t) noexcept
      |   ^~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1915:3: note: candidate: 'constexpr double std::lerp(double, double, double)'
 1915 |   lerp(double __a, double __b, double __t) noexcept
      |   ^~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1911:3: note: candidate: 'constexpr float std::lerp(float, float, float)'
 1911 |   lerp(float __a, float __b, float __t) noexcept
      |   ^~~~
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:26:7: note: candidate: 'float lerp(float, float, float)'
   26 | float lerp(float t, float a, float b){ return a + t * (b - a); }
      |       ^~~~
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:61:19: error: call of overloaded 'lerp(float&, float, float)' is ambiguous
   61 |               lerp(u, grad(P(AB+1), x, y-1, z-1),
      |               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   62 |                    grad(P(BB+1), x-1, y-1, z-1))));
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1919:3: note: candidate: 'constexpr long double std::lerp(long double, long double, long double)'
 1919 |   lerp(long double __a, long double __b, long double __t) noexcept
      |   ^~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1915:3: note: candidate: 'constexpr double std::lerp(double, double, double)'
 1915 |   lerp(double __a, double __b, double __t) noexcept
      |   ^~~~
/Users/klord/Library/Arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/cmath:1911:3: note: candidate: 'constexpr float std::lerp(float, float, float)'
 1911 |   lerp(float __a, float __b, float __t) noexcept
      |   ^~~~
/Users/klord/Desktop/Arduino/ANIMartRIX/noise.ino:26:7: note: candidate: 'float lerp(float, float, float)'
   26 | float lerp(float t, float a, float b){ return a + t * (b - a); }
      |       ^~~~

exit status 1

Compilation error: 'float lerp(float, float, float)' conflicts with a previous declaration

It compiles fine on an RP2040, so ESP32 math lib must be different somehow. Can you take a look please?

moose4lord commented 2 days ago

As an aside, I'm trying to create a model of the M5 computer from the classic Star Trek episode "The Ultimate Computer", which features a round display that looks like this:

M5

The model tries to duplicate this display with a small, round TFT LCD. I have captured a short video clip of the display from that episode and can run it in a loop on the TFT LCD display, and although it looks authentic, running that 3 second loop over and over again gets boring. I'm looking for a way to generate a similar effect algorithmically, and Google led me to your work. I love the organic, floating blob effects in your demos. Any pointers on how to create the sort of scrolling, squiggly line effect from the video clip?

Thanks