-
Notifications
You must be signed in to change notification settings - Fork 3
020. The configuration in EEPROM
The configuration of each module (iotinator master included) is defined in a structure that must not hold variable length members.
The first members needs to be an int that store the version of the config structure, and a type, which is a string describing the type of module.
When a module is initialized, it reads the config from the EEPROM and checks that the version and type of it matches the version and type it's expecting, which are hardcoded. If it does not, it means the EEPROM data is obsolete (it can be data from another type of module, or same type but other version). It's then reset to the default values using the current config data structure, including the version number and type, which will then be good for the next initialization of the module.
The XIOTModule class defines the common structure, and you can extend it to add the config elements that your module will need.
You'll then provide a method to set or reset their default values.