this file contains a series of helper methods for loading and saving menu item to eeprom.
More...
Go to the source code of this file.
this file contains a series of helper methods for loading and saving menu item to eeprom.
◆ 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
-
eeprom | the EEPROM device to save to |
magicKey | the 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
-
eeprom | the EEPROM storage to load from |
magicKey | the 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
-
eeprom | the EEPROM storage to load from |
theItem | the menu item to try and load if the magic key matches |
magicKey | the key to check against, only loaded if the key matches. |
◆ saveMenuItem()
void saveMenuItem |
( |
EepromAbstraction * |
eeprom, |
|
|
MenuItem * |
theItem |
|
) |
| |
Saves a single item back to the EEPROM, it will NOT write the magic key, it is assumed that a full save has already been done at some point in the past.
- Parameters
-
eeprom | the EEPROM storage to save to |
theItem | the item to save |
◆ 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.
◆ setSizeBasedEEPROMStorageEnabled()
void setSizeBasedEEPROMStorageEnabled |
( |
bool |
ena | ) |
|
This enables the sized EEPROM support. When this is on, new items that are beyond the last saved EEPROM position will not attempt to be loaded. This allows new items to initialise properly as long as they are at the end.