Skip to content

Commit 09f3ba5

Browse files
committed
Save static parent to eeprom (for bootloader)
1 parent e1fa3dc commit 09f3ba5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/MySensors/MySensor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
4343
}
4444
setupRadio(paLevel, channel, dataRate);
4545

46-
// Read settings from EEPROM
46+
// 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
4949
eeprom_read_block((void*)&cc, (void*)EEPROM_CONTROLLER_CONFIG_ADDRESS, sizeof(ControllerConfig));
@@ -54,6 +54,8 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
5454

5555
if (_parentNodeId != AUTO) {
5656
nc.parentNodeId = _parentNodeId;
57+
// Save static parent id in eeprom
58+
eeprom_write_byte((uint8_t*)EEPROM_PARENT_NODE_ID_ADDRESS, _parentNodeId);
5759
autoFindParent = false;
5860
} else {
5961
autoFindParent = true;

0 commit comments

Comments
 (0)