Absolute location of system config in EEProm
-
Hi
I want to store some custom config variables in EEprom prior to the hardware init of the system.
The question is where is the system config located in the EEprom and where can I go write without doing damage?
-
If you use saveState() and loadState() the library will handle this for you
-
In addition to saveState, there are also low-level functions to read/write larger blocks: https://github.com/mysensors/MySensors/blob/253109d3ff00ec524c5d1e1dfcd8e197c96e54c2/hal/architecture/MyHwHAL.h#L66
But if you use the low level functions, you'll need to calculate position yourself. You can use EEPROM_LOCAL_CONFIG_ADDRESS as start address.
-
@electrik said in Absolute location of system config in EEProm:
If you use saveState() and loadState() the library will handle this for you
Will this be true for a situation before the mySensors library has been initialized? I want to save my data before the system is loaded.
-
@mfalkvidd said in Absolute location of system config in EEProm:
You can use EEPROM_LOCAL_CONFIG_ADDRESS as start address.
I take it this will be allocated after the system config block? Does this include the locations for saveState()? I noticed that you can give an address for the saveState() to locate the data. If that is not included in the system config block it will make sense to just add a couple of bytes to the EEPROM_LOCAL_CONFIG_ADDRESS and make sure that the saveState() locations are below that.
-
@mariusl I am not sure I understand the question, but saveState will add EEPROM_LOCAL_CONFIG_ADDRESS to the position you use in the call.
-
https://github.com/mysensors/MySensors/blob/253109d3ff00ec524c5d1e1dfcd8e197c96e54c2/core/MyEepromAddresses.h might be useful
-
@mfalkvidd said in Absolute location of system config in EEProm:
@mariusl I am not sure I understand the question, but saveState will add EEPROM_LOCAL_CONFIG_ADDRESS to the position you use in the call.
That is what I asked thanks.
-
@mfalkvidd said in Absolute location of system config in EEProm:
https://github.com/mysensors/MySensors/blob/253109d3ff00ec524c5d1e1dfcd8e197c96e54c2/core/MyEepromAddresses.h might be useful
Wow thanks. That is exactly what I needed.
Thanks for the help, you are a champion.