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
+2
View File
@@ -51,9 +51,11 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
} }
if (_parentNodeId != AUTO) { if (_parentNodeId != AUTO) {
if (_parentNodeId != nc.parentNodeId) {
nc.parentNodeId = _parentNodeId; nc.parentNodeId = _parentNodeId;
// Save static parent id in eeprom // Save static parent id in eeprom
eeprom_write_byte((uint8_t*)EEPROM_PARENT_NODE_ID_ADDRESS, _parentNodeId); eeprom_write_byte((uint8_t*)EEPROM_PARENT_NODE_ID_ADDRESS, _parentNodeId);
}
autoFindParent = false; autoFindParent = false;
} else { } else {
autoFindParent = true; autoFindParent = true;