Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
14.66k stars 3.15k forks source link

Fix default button pin assignment for esp32 #4074

Closed PaoloTK closed 1 month ago

PaoloTK commented 2 months ago

When using the BTNPIN compile flag to assign button pins in 0.15 you must define your pins and then add leading "-1" until WLED_MAX_BUTTONS, which is expected behavior (https://github.com/Aircoookie/WLED/issues/3953). However if you don't define BTNPIN at compile a similar issue occurs on ESP32 due to the default def only having 2 pins. I added an if statement to define 4 default pins in case we're compiling for ESP32.

I also changed the BTNTYPE def. It currently has a def for 2 pins with the second being BTN_TYPE_NONE. However since BTN_TYPE_NONE = 0 any type not configured will automatically evaluate to BTN_TYPE_NONE.

softhack007 commented 2 months ago

Hi,

I think this solution is not good for the generic case, as it simply "postpones" the problem because users may want WLED_MAX_BUTTONS >4 (12, or maybe even 16). See my comment in #3953.