@@ -46,7 +46,7 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
4646 // Read settings from EEPROM
4747 eeprom_read_block ((void *)&nc, (void *)EEPROM_NODE_ID_ADDRESS, sizeof (NodeConfig));
4848 // Read latest received controller configuration from EEPROM
49- eeprom_read_block ((void *)&cc, (void *)EEPROM_LOCAL_CONFIG_ADDRESS , sizeof (ControllerConfig));
49+ eeprom_read_block ((void *)&cc, (void *)EEPROM_CONTROLLER_CONFIG_ADDRESS , sizeof (ControllerConfig));
5050 if (cc.isMetric == 0xff ) {
5151 // Eeprom empty, set default to metric
5252 cc.isMetric = 0x01 ;
@@ -328,11 +328,12 @@ boolean MySensor::process() {
328328 bool isMetric;
329329
330330 if (type == I_REBOOT) {
331+ // Requires MySensors or other bootloader with watchdogs enabled
331332 wdt_enable (WDTO_15MS);
332333 for (;;);
333334 } else if (type == I_ID_RESPONSE) {
334335 if (nc.nodeId == AUTO) {
335- nc.nodeId = msg.getInt ();
336+ nc.nodeId = msg.getByte ();
336337 // Write id to EEPROM
337338 if (nc.nodeId == AUTO) {
338339 // sensor net gateway will return max id if all sensor id are taken
@@ -347,14 +348,13 @@ boolean MySensor::process() {
347348 } else if (type == I_CONFIG) {
348349 // Pick up configuration from controller (currently only metric/imperial)
349350 // and store it in eeprom if changed
350- isMetric = msg.getByte () == ' M' ;
351+ isMetric = msg.getString ()[ 0 ] == ' M' ;
351352 if (cc.isMetric != isMetric) {
352353 cc.isMetric = isMetric;
353354 eeprom_write_byte ((uint8_t *)EEPROM_CONTROLLER_CONFIG_ADDRESS, isMetric);
354- // eeprom_write_block((const void*)&cc, (uint8_t*)EEPROM_CONTROLLER_CONFIG_ADDRESS, sizeof(ControllerConfig));
355355 }
356356 } else if (type == I_CHILDREN) {
357- if (repeaterMode && msg.getByte () == ' C' ) {
357+ if (repeaterMode && msg.getString ()[ 0 ] == ' C' ) {
358358 // Clears child relay data for this node
359359 debug (PSTR (" rd=clear\n " ));
360360 for (uint8_t i=0 ;i< sizeof (childNodeTable); i++) {
0 commit comments