AaronLiddiment / LEDSprites

FastLED Sprite Class requires LEDMatrix Class
33 stars 19 forks source link

Errors with max and min functions when compiling for ESP32 with Arduino IDE #1

Open s-marley opened 5 years ago

s-marley commented 5 years ago

When compiling for ESP32, errors are thrown in LEDSprites.cpp when mixing types in the min() and max() functions. I don't have the exact error to hand but if I remember correctly in each case one parameter is an int, the other a uint8_t.

This used to work, but I believe something changed in the way the ESP32 code is compiled under the Arduino environment. If anyone else has this problem, a quick fix is to replace min() and max() with _min() and _max() everywhere they appear in LEDSprites.cpp.

veitk commented 5 years ago

Wow thanks for that. Was about to give up...

Hermesfrank commented 3 years ago

I tried the above changes, but still same result that it would not compile and I get basically the same error message, but the "_min(...)" shows instead of the original...

Am I doing something wrong? I saved a copy of the LEDSprites.cpp file, then used Notepad++ to make above changes (I think I found two occurrences of each), saved the file and started the IDE - should I be doing something further? I really want to get this running! I tried compiling both for the ESP32 Thing, and a generic ESP32 board...compiles OK for me on Arduino boards (if I use the original file)...

Thanks, Frank

s-marley commented 3 years ago

@Hermesfrank sorry, that worked for me :( not sure what elese to suggest I'm afraid. If the error messages you're getting are referencing _min(...) etc then it's obviously picking up the right file. I guess just make sure you have the latest version of ESP32 installed in boards manager (I'm running 1.0.4). Also, my setup where it compiles fine looks like this if that's any use. image

Hermesfrank commented 3 years ago

@s-marley Well, I continued to check this out...your comment about using the correct file made me wonder, so I looked further up into the error message and saw some reference to the "LEDSprites - Copy.cpp" file...I had just used Windows File Manage copy/paste to create the copy for safekeeping prior to editing the file and of course left it in the directory...for some reason, the compiler used/referred to the safe-file at some point...I removed the safe-file from the directory, and lo-and-behold, the sketch compiled OK! Learn something new every day, eh..

Thanks for your response and confirmation that your fix should work and that your board info and version were same as mine (and for posting in the first place!), or I would have given up in frustration...

Best regards, Frank