davetcc / tcMenu

Menu library for Arduino, mbed and ESP with designer UI and remote control capabilities.
https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/
Apache License 2.0
271 stars 25 forks source link

No encoder, TCMenu 4.1+ #455

Open tomelgato opened 4 months ago

tomelgato commented 4 months ago

Refering to closed #402:

I just created a new board without the encoder, boom, I could not see the edit and active item cursor, and could not change position. It was caused because there has to be an encoder (even if it is an empty one), I'll be making a commit against this hopefully today and it should therefore be fixed in 4.2. If the change is as simple as I expect, you could try it easily once I commit the change.

Seems it is still not working in 4.2. I still need this little hack which works:

The only real change (that will need a change in the plugins to work) was adding this method to the keyboard listener in the library:

tcMenuKeyListener.createInternalEncoder(); This makes sure there is a default encoder. If there is not one, it creates it. You could simply try for now and add:

switches.setEncoder(0, new RotaryEncoder([](int v) { menuMgr.valueChanged(v); })); after the setupMenu() call.

davetcc commented 3 months ago

Let me look at this again to make sure there is an encoder in all cases, one possibility is a catch-all in the menu initialisation that ensures there is always an encoder present and creates one if not, then code elsewhere does not need to worry about it; IE the back stop to create it is there. I'll see if I can add it.

davetcc commented 3 months ago

Tracking lib issue - https://github.com/davetcc/tcMenuLib/issues/213

davetcc commented 3 months ago

could you try to patch your local tcMenu.cpp with the change in the above issue, it should create an encoder if there is not already one in the no input initialisation.

tomelgato commented 2 months ago

Will test asap when im on that machine again