blazoncek / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
MIT License
31 stars 0 forks source link

Unable to assign more than 10 buttons #11

Closed shupershuff closed 2 years ago

shupershuff commented 2 years ago

What happened?

Currently when specifying more than 10 buttons, WLED only allows you to configure pins for the first 10 (0 through to 9). Setting additional pins reverts back to -1, except for button 10 which gets set to 0.

When compiling, I'm using the build flag -D WLED_MAX_BUTTONS=14 I'm using a 38pin ESP32. In PIO the board type I'm using is "board = esp-wrover-kit". Whilst I don't know C++ I can vaguely read the config files and I haven't found anything obvious that's setting a button limit of 10.

"Why so many buttons?" The reason for so many buttons is that I'm making a physical controller with 2 digital joysticks, each of which have 7 digital buttons (left, right ,up, down, Middle (joystick press), set & reset).

To Reproduce Bug

As per the above, simply adding more than 10 buttons and trying to set the pins for anything past Button 9 fails.

image

Expected Behavior

Would expect that you could set as many pins as an ESP32 would allow for.

Install Method

Self-Compiled

What version of WLED?

0.13.0-b5 build 2111190

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

No response

Anything else?

No response

Code of Conduct

blazoncek commented 2 years ago

There is nothing in the code to prevent usage of >10 GPIO inputs. The only exception is availability of GPIO pins (some are reserved). Reorder your GPIOs and observe what happens.

BTW, GPIO16 & GPIO17 are unsuitable on WROVER models.

shupershuff commented 2 years ago

This is a 38pin WROOM model. I've tested each button successfully, just can't add more than 10 (in any order) in the software. If I do the tenth one saves as pin 0 and the others after it save as -1.

blazoncek commented 2 years ago

I think I have found the problem.

shupershuff commented 2 years ago

There's every possibility I've set the wrong board type in platformio.io. The website isn't hugely helpful to determine which one I'm using. The esp32 I got is the 38 pin from here.

blazoncek commented 2 years ago

No, the problem is in the anticipation of the code. JS behaves differntly than C/C++.

shupershuff commented 2 years ago

Is this something that will need fixing in the next release do you think?

blazoncek commented 2 years ago

Possible fix pushed to my fork. Will need to test it though.