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 renders an interactive list of configurable settings. It supports four setting types — boolean toggles, numeric ranges, option selectors, and links to sub-screens — each with its own visual control. Values are persisted automatically to EEPROM (ESP8266) or Preferences (ESP32) and restored on the next boot.
Constructors
SettingsScreen()
Creates a settings screen without a title.
SettingsScreen(const char* title)
Creates a settings screen with the given title shown in the header.
Title string displayed at the top of the screen.
Adding settings
addBooleanSetting(const char* name, bool defaultValue)
Adds an on/off toggle setting rendered as an animated switch.
Display name of the setting. Also used as the key for
getSettingValue(const char*).Initial value used when no persisted value exists.
addRangeSetting(const char* name, uint8_t min, uint8_t max, uint8_t defaultValue, const char* unit)
Adds a numeric range setting rendered as a scrollable value with optional unit label.
Display name of the setting.
Minimum allowed value (inclusive).
Maximum allowed value (inclusive).
Initial value used when no persisted value exists.
Optional unit string displayed after the value (e.g.
"%", "°C", "dB").addOptionSetting(const char* name, const char** options, uint8_t count, uint8_t defaultIndex)
Adds a setting that cycles through a fixed list of string options.
Display name of the setting.
Pointer to an array of option label strings.
Number of entries in the
options array.Zero-based index of the initially selected option.
addSubscreenSetting(const char* name, Screen* targetScreen)
Adds a navigation entry that pushes a different screen when selected. Use this to link to a secondary SettingsScreen when you need more than MAX_ITEMS settings.
Label displayed in the settings list.
Screen to navigate to when the item is selected.
Reading values
getSettingValue(int index)
Returns the current value of a setting by its zero-based position in the list.
- For
BOOLEAN: returns1(true) or0(false). - For
RANGE: returns the current numeric value. - For
OPTION: returns the current selected index.
uint8_t
Zero-based index of the setting.
getSettingValue(const char* name)
Returns the current value of a setting looked up by its name string.
Returns: uint8_t
Name string matching the one passed to
add*Setting().getSettingName(int index)
Returns the display name of the setting at the given index.
Returns: String
Zero-based index of the setting.
getSettingType(uint8_t index)
Returns the type enum of the setting at the given index.
Returns: Setting::Type — one of Setting::BOOLEAN, Setting::RANGE, Setting::OPTION, or Setting::SUBSCREEN.
Zero-based index of the setting.
Modification
modify(int8_t direction, int index)
Programmatically increments or decrements a setting value by index. Use +1 to move forward and -1 to move backward.
1 to increment / toggle on; -1 to decrement / toggle off.Zero-based index of the setting to modify.
modify(int8_t direction, const char* name)
Programmatically changes a setting value by name.
1 to increment / toggle on; -1 to decrement / toggle off.Name string of the setting to modify.
Storage
resetSettings()
Clears all persisted values and restores every setting to its defaultValue. A restart is required for the reset to take full effect in the UI.
EEPROM/Preferences storage is fully automatic. You do not need to call any save or load function — values are persisted whenever a setting is changed and restored on the next
begin(). saveToEEPROM() and readFromEEPROM() are private implementation details.Constants
| Constant | Value | Description |
|---|---|---|
MAX_ITEMS | 10 | Maximum number of settings per SettingsScreen instance. |