tcMenu
Functions
EepromItemStorage.h File Reference

Go to the source code of this file.

Functions

void saveMenuStructure (EepromAbstraction *eeprom, uint16_t magicKey=0xfade)
 
bool loadMenuStructure (EepromAbstraction *eeprom, uint16_t magicKey=0xfade)
 
bool loadMenuItem (EepromAbstraction *eeprom, MenuItem *theItem, uint16_t magicKey=0xfade)
 
void triggerAllChangedCallbacks ()
 

Detailed Description

this file contains a series of helper methods for loading and saving menu item to eeprom.

Function Documentation

◆ saveMenuStructure()

void saveMenuStructure ( EepromAbstraction *  eeprom,
uint16_t  magicKey = 0xfade 
)

Save a menu structure to the EEPROM storage device passed in, such that all editable menu items with valid EEPROM address (IE not -1). The eeprom structure will be saved after the first two bytes which are the magic key. This key is so that we know the structure is valid when loading back

Parameters
eepromthe EEPROM device to save to
magicKeythe magic key to store, will be validated on loading back.

◆ loadMenuStructure()

bool loadMenuStructure ( EepromAbstraction *  eeprom,
uint16_t  magicKey = 0xfade 
)

Loads a menu structure back from EEPROM storage into the menu items, but only if the magic key in the first two bytes matches exactly.

Parameters
eepromthe EEPROM storage to load from
magicKeythe key to check against, only loaded if the key matches.

◆ loadMenuItem()

bool loadMenuItem ( EepromAbstraction *  eeprom,
MenuItem theItem,
uint16_t  magicKey = 0xfade 
)

Loads a single menu item back from storage, this can be used to selectively load items from the EEPROM. Mainly for cases when you want to selectively load a few items from ROM.

Parameters
eepromthe EEPROM storage to load from
theItemthe menu item to try and load if the magic key matches
magicKeythe key to check against, only loaded if the key matches.

◆ triggerAllChangedCallbacks()

void triggerAllChangedCallbacks ( )

This will trigger callbacks in a controlled manner, for only items that would be loaded from EEPROM, and only if the item is marked as changed. This is much safer than the previous option, which was to run all callbacks as part of the load call, when most of the system may not have started yet.