Chatting about storing data into the EEPROM with @paqor I got a little bit curious what the mysensors library stores into that EEPROM so I wrote a little function for dumping that data. I tested it with the 1.4 version of the library:
void DumpMySensorsEepromData()
{
Serial.println("Dumping MySensors EEPROM:");
Serial.println("");
Serial.print("Node id: ");
Serial.println(EEPROM.read(EEPROM_NODE_ID_ADDRESS));
Serial.print("Parent node id: ");
Serial.println(EEPROM.read(EEPROM_PARENT_NODE_ID_ADDRESS));
Serial.print("Distance: ");
Serial.println(EEPROM.read(EEPROM_DISTANCE_ADDRESS));
Serial.println("");
// child --> route
Serial.println("Routing information: ");
for (int route = EEPROM_ROUTES_ADDRESS; route < EEPROM_CONTROLLER_CONFIG_ADDRESS; route++)
{
int child = route - EEPROM_ROUTES_ADDRESS;
uint8_t destination = EEPROM.read(route);
if (destination != 0xff)
{
Serial.print(child);
Serial.print(" --> ");
Serial.print(destination);
Serial.println("");
}
}
Serial.println("");
// metric imperial
Serial.println("Controller config: ");
uint8_t isMetric = EEPROM.read(EEPROM_CONTROLLER_CONFIG_ADDRESS);
if (isMetric == 0xFF)
{
Serial.println("is metric");
}
else
{
Serial.println("is imperial");
}
Serial.println("");
Serial.println("Controller config raw data: ");
for (int config = EEPROM_CONTROLLER_CONFIG_ADDRESS; config < EEPROM_FIRMWARE_TYPE_ADDRESS; config++)
{
Serial.print(EEPROM.read(config));
Serial.print(", ");
if ((config - EEPROM_CONTROLLER_CONFIG_ADDRESS + 1) % 8 == 0)
{
Serial.println("");
}
}
Serial.println("");
Serial.print("Firmware Type: ");
Serial.print(EEPROM.read(EEPROM_FIRMWARE_TYPE_ADDRESS + 0));
Serial.print(", ");
Serial.println(EEPROM.read(EEPROM_FIRMWARE_TYPE_ADDRESS + 1));
Serial.print("Firmware Version: ");
Serial.print(EEPROM.read(EEPROM_FIRMWARE_BLOCKS_ADDRESS + 0));
Serial.print(", ");
Serial.println(EEPROM.read(EEPROM_FIRMWARE_BLOCKS_ADDRESS + 1));
Serial.print("Firmware Blocks: ");
Serial.print(EEPROM.read(EEPROM_FIRMWARE_VERSION_ADDRESS + 0));
Serial.print(", ");
Serial.println(EEPROM.read(EEPROM_FIRMWARE_VERSION_ADDRESS + 1));
Serial.print("Firmware CRC: ");
Serial.print(EEPROM.read(EEPROM_FIRMWARE_CRC_ADDRESS + 0));
Serial.print(", ");
Serial.println(EEPROM.read(EEPROM_FIRMWARE_CRC_ADDRESS + 1));
Serial.println("");
Serial.print("Start of local user config is at address: ");
Serial.println(EEPROM_LOCAL_CONFIG_ADDRESS);
Serial.println("");
Serial.println("Local user data: ");
for (int localConfig = EEPROM_LOCAL_CONFIG_ADDRESS; localConfig < EEPROM_LOCAL_CONFIG_ADDRESS + 255; localConfig++)
{
Serial.print(EEPROM.read(localConfig));
Serial.print(", ");
if ((localConfig - EEPROM_LOCAL_CONFIG_ADDRESS + 1) % 8 == 0)
{
Serial.println("");
}
}
Serial.println("");
}
The output looks as follows:
Dumping MySensors EEPROM:
Node id: 1
Parent node id: 0
Distance: 1
Routing information:
0 --> 0
1 --> 1
2 --> 100
5 --> 101
65 --> 101
100 --> 100
101 --> 101
102 --> 102
104 --> 100
105 --> 105
106 --> 106
107 --> 107
108 --> 108
109 --> 109
110 --> 110
111 --> 111
112 --> 112
129 --> 101
243 --> 243
Controller config:
is imperial
Controller config raw data:
1, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
Firmware Type: 255, 255
Firmware Version: 255, 255
Firmware Blocks: 255, 255
Firmware CRC: 255, 255
Start of local user config is at address: 291
Local user data:
255, 0, 0, 0, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 1, 1, 1, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
...
The data is from a repeater. Note that the layout may change in upcoming mysensors versions.
Your local data is for example stored at offset 291, so be careful when using the native EEPROM functions where you have to provide an offset!