Skip to content

Commit 2d214a1

Browse files
committed
Fix static id problem when using OTA bootloader. Reported by tekka.
1 parent 7a54cac commit 2d214a1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libraries/MySensors/MySensor.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
5959
autoFindParent = true;
6060
}
6161

62-
if (_nodeId != AUTO) {
63-
// Set static id
64-
nc.nodeId = _nodeId;
62+
if ( (_nodeId != AUTO) && (nc.nodeId != _nodeId) ) {
63+
// Set static id
64+
nc.nodeId = _nodeId;
65+
// Save static id in eeprom
66+
eeprom_write_byte((uint8_t*)EEPROM_NODE_ID_ADDRESS, _nodeId);
6567
}
6668

6769
// If no parent was found in eeprom. Try to find one.

0 commit comments

Comments
 (0)