Hi Dave,
On the description page of the encoders/switches plugin there's a code snippet that shows how to use a second encoder to change a certain menu item directly.
I'm wondering if it's easily doable to make it so that the 2nd encoder changes the value of the item "under the cursor", without activating (clicking) that item under the cursor? I'm working on a project where there's a lot of configuring going on, with dynamically changing enums etc. Using two encoders would speed up the use of the menu tremendously, since the user wouldn't have to click the menu, edit value, click to accept, go down, click enum, modify enum, click to accept, go up again to go to the value, etc. (I'll can a video of this process if you want).
I think the code for this would become something like: (pseudo-ish code)
// somewhere globally, define the variable
HardwareRotaryEncoder* secondEncoder;
void setuo() {
// other stuff...
setupMenu(); // Important! This must be before any usage of switches
// here we assume that menuVolume was defined in your menu project as an analog item
secondEncoder = new HardwareRotaryEncoder(pinA, pinB, [](int encoderValue) {
activeMenuItem = ... ???
switch(activeMenuItem) {
"menuvolume" : increase_or_decrease_volume(); // ???
break;
"menuchannel" : increase_or_decrease_channel();
break;
etc....
});
secondEncoder->changePrecision(menuVolume.getMaximumValue(), menuVolume.getCurrentValue());
switches.setEncoder(1, secondEncoder);
}
Would this be the way to go? If so, how do I find out the activeMenuItem, and where would I put the changePrecision() call? This last one should probably change whenever one turns the primary encoder, right?
Also, is there a way to get the highlighter menuitem in the middle of the (TFTeSPI) screen? I'd like to see at least two lines of menu *below* the current highlighted item, but when scrolling up the bottom one disappears off-screen.