From 2d214a1e58ba3208a6f901791e351451c5b6a949 Mon Sep 17 00:00:00 2001 From: Henrik Ekblad Date: Sun, 1 Feb 2015 15:29:02 +0100 Subject: [PATCH] Fix static id problem when using OTA bootloader. Reported by tekka. --- libraries/MySensors/MySensor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/MySensors/MySensor.cpp b/libraries/MySensors/MySensor.cpp index d0311aa..a613d02 100755 --- a/libraries/MySensors/MySensor.cpp +++ b/libraries/MySensors/MySensor.cpp @@ -59,9 +59,11 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b autoFindParent = true; } - if (_nodeId != AUTO) { - // Set static id - nc.nodeId = _nodeId; + if ( (_nodeId != AUTO) && (nc.nodeId != _nodeId) ) { + // Set static id + nc.nodeId = _nodeId; + // Save static id in eeprom + eeprom_write_byte((uint8_t*)EEPROM_NODE_ID_ADDRESS, _nodeId); } // If no parent was found in eeprom. Try to find one.