@@ -46,7 +46,7 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
46
46
// Read settings from EEPROM
47
47
eeprom_read_block ((void *)&nc, (void *)EEPROM_NODE_ID_ADDRESS, sizeof (NodeConfig));
48
48
// 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));
50
50
if (cc.isMetric == 0xff ) {
51
51
// Eeprom empty, set default to metric
52
52
cc.isMetric = 0x01 ;
@@ -328,11 +328,12 @@ boolean MySensor::process() {
328
328
bool isMetric;
329
329
330
330
if (type == I_REBOOT) {
331
+ // Requires MySensors or other bootloader with watchdogs enabled
331
332
wdt_enable (WDTO_15MS);
332
333
for (;;);
333
334
} else if (type == I_ID_RESPONSE) {
334
335
if (nc.nodeId == AUTO) {
335
- nc.nodeId = msg.getInt ();
336
+ nc.nodeId = msg.getByte ();
336
337
// Write id to EEPROM
337
338
if (nc.nodeId == AUTO) {
338
339
// sensor net gateway will return max id if all sensor id are taken
@@ -347,14 +348,13 @@ boolean MySensor::process() {
347
348
} else if (type == I_CONFIG) {
348
349
// Pick up configuration from controller (currently only metric/imperial)
349
350
// and store it in eeprom if changed
350
- isMetric = msg.getByte () == ' M' ;
351
+ isMetric = msg.getString ()[ 0 ] == ' M' ;
351
352
if (cc.isMetric != isMetric) {
352
353
cc.isMetric = isMetric;
353
354
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));
355
355
}
356
356
} else if (type == I_CHILDREN) {
357
- if (repeaterMode && msg.getByte () == ' C' ) {
357
+ if (repeaterMode && msg.getString ()[ 0 ] == ' C' ) {
358
358
// Clears child relay data for this node
359
359
debug (PSTR (" rd=clear\n " ));
360
360
for (uint8_t i=0 ;i< sizeof (childNodeTable); i++) {
0 commit comments