Skip to content

Commit 08221e6

Browse files
committed
Merge pull request arduino#46 from tekka007/master
Failed transmissions count fixed & Clear routing table extendend
2 parents 42885d4 + f06e915 commit 08221e6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libraries/MySensors/MySensor.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ boolean MySensor::sendRoute(MyMessage &message) {
200200
// need to find another route to gateway.
201201
if (autoFindParent && failedTransmissions > SEARCH_FAILURES) {
202202
findParentNode();
203+
} else {
204+
failedTransmissions++;
203205
}
204-
failedTransmissions++;
205206
} else {
206207
failedTransmissions = 0;
207208
}
@@ -367,6 +368,11 @@ boolean MySensor::process() {
367368
for (uint8_t i=0;i< sizeof(childNodeTable); i++) {
368369
removeChildRoute(i);
369370
}
371+
// Clear parent node id & distance to gw
372+
eeprom_write_byte((uint8_t*)EEPROM_PARENT_NODE_ID_ADDRESS, 0xFF);
373+
eeprom_write_byte((uint8_t*)EEPROM_DISTANCE_ADDRESS, 0xFF);
374+
// Find parent node
375+
findParentNode();
370376
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CHILDREN,false).set(""));
371377
}
372378
} else if (type == I_TIME) {

0 commit comments

Comments
 (0)