adafruit / Adafruit_Protomatter

RGB matrix library for Arduino
57 stars 20 forks source link

error: cannot convert 'bool' to 'timer_alarm_t' in assignment #70

Closed prabbit237 closed 8 months ago

prabbit237 commented 8 months ago

Thank you for opening an issue on an Adafruit Arduino library repository. To improve the speed of resolution please review the following guidelines and common troubleshooting steps below before creating the issue:

If you're sure this issue is a defect in the code and checked the steps above please fill in the following fields to provide enough troubleshooting information. You may delete the guideline and text above to just leave the following details:

Compiling using PlatformIO gives an error on two lines in the library:

CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.4.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
[................]
Compiling .pio/build/esp32dev/lib059/RGB matrix Panel_ID587/RGBmatrixPanel.cpp.o
.pio/libdeps/esp32dev/RGB matrix Panel_ID587/RGBmatrixPanel.cpp: In member function 'void RGBmatrixPanel::begin()':
.pio/libdeps/esp32dev/RGB matrix Panel_ID587/RGBmatrixPanel.cpp:287:27: error: cannot convert 'bool' to 'timer_alarm_t' in assignment
     tim_config.alarm_en = true;
                           ^~~~
.pio/libdeps/esp32dev/RGB matrix Panel_ID587/RGBmatrixPanel.cpp:288:30: error: cannot convert 'bool' to 'timer_autoreload_t' in assignment
     tim_config.auto_reload = true;
                              ^~~~
.pio/libdeps/esp32dev/RGB matrix Panel_ID587/RGBmatrixPanel.cpp: In member function 'void RGBmatrixPanel::updateDisplay()':
.pio/libdeps/esp32dev/RGB matrix Panel_ID587/RGBmatrixPanel.cpp:780:77: warning: right shift count >= width of type [-Wshift-count-overflow]
   TG[TIMER_GROUP_1]->hw_timer[TIMER_0].alarm_high = (uint32_t) (duration >> 32);
                                                                             ^~
*** [.pio/build/esp32dev/lib059/RGB matrix Panel_ID587/RGBmatrixPanel.cpp.o] Error 1

Typecasting resolves the issue:

---     tim_config.alarm_en = true;
---     tim_config.auto_reload = true;
+++    tim_config.alarm_en = (timer_alarm_t) true;
+++    tim_config.auto_reload = (timer_autoreload_t) true;

The code does compile OK inn the Arduino IDE 2.2.1 so it must be some small difference in the build flags.

prabbit237 commented 8 months ago

I'm sorry, the errors are in another library: https://github.com/adafruit/RGB-matrix-Panel/issues (I was adding protomatter so a project and then got the error and wasn't watching the source of the error that close.)

So the error exists but it's in https://github.com/adafruit/RGB-matrix-Panel/issues and not this repository.