Merge pull request #61 from mapnull/hotfix-parentId_eeprom

Write parentNodeId to eeprom only when differ
This commit is contained in:
Henrik Ekblad
2015-02-12 22:15:37 +01:00
+5 -3
View File
@@ -51,9 +51,11 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
}
if (_parentNodeId != AUTO) {
nc.parentNodeId = _parentNodeId;
// Save static parent id in eeprom
eeprom_write_byte((uint8_t*)EEPROM_PARENT_NODE_ID_ADDRESS, _parentNodeId);
if (_parentNodeId != nc.parentNodeId) {
nc.parentNodeId = _parentNodeId;
// Save static parent id in eeprom
eeprom_write_byte((uint8_t*)EEPROM_PARENT_NODE_ID_ADDRESS, _parentNodeId);
}
autoFindParent = false;
} else {
autoFindParent = true;