neu-rah/ArduinoMenu

Preventing the rotary encoder to cycle through

dhysuiej opened this issue · 2 comments

I want a menu or numeric field to stop changing its value one it reaches the upper or lower limit in the range. Is that posible with the latest released version or would I need to change the corresponding classes?

For both MENU and FIELD, use Menu::noStyle instead of Menu::wrapStyle for the last argument.

In the following example, both the menu and the "LED" field are constrained and do not wrap around.

MENU(mainMenu, "configuration", Menu::doNothing, Menu::noEvent, Menu::noStyle
  ,FIELD(pwmled,"LED","", 0,255,10,1,Menu::doNothing, Menu::noEvent, Menu::noStyle)
  ,EXIT("<Back")
);

It works for me, with the current library release.

@keldonin thanks a lot.