Documentation Index
Fetch the complete documentation index at: https://mintlify.com/The-Young-Maker/OpenMenuOS/llms.txt
Use this file to discover all available pages before exploring further.
SettingsScreen provides a ready-made interface for user-configurable options. Rather than building toggle switches, sliders, and option pickers from scratch, you declare what kind of setting you need, supply its default value, and the library handles rendering, user interaction, and persistent storage. On ESP32 the Preferences library is used; on ESP8266 the standard EEPROM library is used. Both are abstracted away — your code is the same either way.
The four setting types
Setting::Type is an enum that determines how a setting is displayed and edited:
| Type | Renders as | Value stored |
|---|---|---|
BOOLEAN | Animated toggle switch | bool (returned as uint8_t 0 or 1) |
RANGE | Slider with optional unit label | uint8_t (min–max inclusive) |
OPTION | Cycling option list | uint8_t index into options array |
SUBSCREEN | Navigation link (arrow) | — (navigates to another Screen) |
add* helper method on SettingsScreen.
SettingsScreen enforces MAX_ITEMS = 10 settings per instance. Use addSubscreenSetting() to chain additional SettingsScreen objects when you need more.Adding settings
Boolean setting
A boolean setting renders as an animated toggle switch. The user flips it with the Select button.Range setting
A range setting renders as a horizontal slider. The user increments or decrements the value with Up/Down. The optionalunit string is displayed alongside the value.
Option setting
An option setting cycles through a fixed array of string labels. Pass aconst char** array and its length.
Subscreen setting
A subscreen setting renders as a labelled row with a right-arrow indicator. Selecting it navigates to the targetScreen (typically another SettingsScreen).
Reading setting values
Two overloads ofgetSettingValue() let you retrieve the current value of any setting.
- By index
- By name
Access a setting by its position (zero-based) in the order it was added.
uint8_t. For boolean settings 0 = off, 1 = on. For option settings the value is the selected index into the options array.
Automatic EEPROM persistence
Settings are automatically saved whenever the user changes a value. On the next boot,SettingsScreen reads the stored values before the first draw(), so the UI reflects the user’s last choices without any code in setup().
- ESP32: Uses the
Preferenceslibrary (key-value namespace) - ESP8266: Uses the
EEPROMlibrary (byte-addressed storage)
The
Preferences namespace is closed automatically when a SettingsScreen is destroyed, preventing resource leaks on ESP32.Resetting to defaults
CallresetSettings() to wipe persisted values and revert all settings to the defaults specified in the add* calls. A restart is required for the reset to take full effect.