Closed frankalicious closed 18 hours ago
If one button is active https://github.com/dasdgw/yoradio/blob/5d129c623c6b50a69bf8988753f4a0c9a5b0c970/yoRadio/src/core/controls.cpp#L14
A global array button
of OneButton classes is initialized
https://github.com/dasdgw/yoradio/blob/5d129c623c6b50a69bf8988753f4a0c9a5b0c970/yoRadio/src/core/controls.cpp#L17
This creates an error during because the pinMode is set with an invalid pun number https://github.com/dasdgw/yoradio/blob/5d129c623c6b50a69bf8988753f4a0c9a5b0c970/yoRadio/src/OneButton/OneButton.cpp#L53
In the loop there is a problem because BTN_MODE is missing in the for loop. https://github.com/dasdgw/yoradio/blob/5d129c623c6b50a69bf8988753f4a0c9a5b0c970/yoRadio/src/core/controls.cpp#L145 It should be added as here https://github.com/dasdgw/yoradio/blob/5d129c623c6b50a69bf8988753f4a0c9a5b0c970/yoRadio/src/core/controls.cpp#L101
We could also try to only add a button instance if the pin is not defined to 255. If I add an ifdef around a button instance like:
#if (BTN_LEFT!=255)
{BTN_LEFT, true, BTN_INTERNALPULLUP},
#endif
I get __pinMode(): Invalid IO 255 selected only 6 times on startup. But it's a little bit ugly. And I failed trying to put this in a macro.
We could also try to only add a button instance if the pin is not defined to 255. If I add an ifdef around a button instance like:
#if (BTN_LEFT!=255) {BTN_LEFT, true, BTN_INTERNALPULLUP}, #endif
I get __pinMode(): Invalid IO 255 selected only 6 times on startup. But it's a little bit ugly. And I failed trying to put this in a macro.
That's what I tried but I may forgot the brackets so I could not compile it. I think that's my preffered solution because we could also remove the check in the loop.
I found my problem. I tried to put the 3 lines in 1 line and that does not work.
Nevertheless I think it's not so easy to reduce the size of the button array.
In initControls() the parameter for the functions called by the callback are using the id as parameter. (e.g. void onBtnClick(int id) {
They have a fixed value from the enum controlEvt_e.
Closed by ccca082.
Latest commit in esp32-audioI2S-3.0.9i.
Clean git repo.
I'm not sure which pin creates these error.