Skip to content
Rui Azevedo edited this page Feb 29, 2020 · 14 revisions

Invert navigation direction on numeric fields

options->invertFieldKeys

Up command increases the selected item index, if you are using buttons or custom navigation you might have to switch up/down commands for them to make sense from your input perspective. However some input methods require numeric field values to increase/decrease in reverse order. In that case you can set options->invertFieldKeys to either true or false to match your expectations.

Hide menu titles

nav.showTitle=false

use on setup, assuming that navigation root object is nav. This is a dynamic property can be set at runtime (any time) and will hide titles for all menus on the root tree. Local menu setting can reverse this, either to hide or to show the title.

Time critical systems

Even though this is a non-blocking system, this menu still needs time slices to do IO. Some time critical parallel tasks, like updating direct wired 7-segment displays, might experience some flicking while the menu is being used. This can be mitigated by starting with a suspended menu and by exiting the menu after it has been used.

More critical systems like steppers can prevent all menu IO by not calling the menu poll or IO functions, but for these cases a timer is recommended.

Current navigation level controller

nav.node()

return a (navNode) navigation level controller object, see navigation

Active menu

nav.active()

returns a menuNode object, the menuNode is a menu prompt that can receive keys/comands and has an optional associated action

Can be a menu/sub-menu or any kind of field.

Selected option

nav.node().sel

return the index of the selected option

Get option by index

nav.node()[idx]

return a prompt object representing the indexed option

Get selected option

nav.selected()

return a prompt object representing the current selected option

Start without menu

on setup do:

nav.idleOn(user_function);//this menu will start on idle state, press select to enter menu

suspended menu will resume when pressing select

Also you can have any other suspension method because the menu is executed only when one of its IO functions is called (poll/doInput/doOutput). So if it's not calling them, there is no menu.

Prevent menu from exit

on setup function:

options->canExit=false;

Also you can provide an alternative config options setting, with that options already set to false.

Reset current menu selection to top

nav.doNav(navCmd(idxCmd,0))

Get a field value

The menu does not store values (maybe some backups) instead it uses existing values from your code, so you already have access to field values. The menu system will change the variable value when needed.

example:

//outside setup or loop
int percent=0;

...

//on menu definition
FIELD(percent,"Power","%",...)

...

//when you want the value just use the variable
//in example, for printing
Serial.print("my percent value:");
Serial.println(percent);