fix a case where parent distance from repeater get stuck at 255
This commit is contained in:
@@ -285,11 +285,15 @@ boolean MySensor::process() {
|
|||||||
uint8_t destination = msg.destination;
|
uint8_t destination = msg.destination;
|
||||||
|
|
||||||
if (repeaterMode && command == C_INTERNAL && type == I_FIND_PARENT) {
|
if (repeaterMode && command == C_INTERNAL && type == I_FIND_PARENT) {
|
||||||
// Relaying nodes should always answer ping messages
|
if (nc.distance == 255) {
|
||||||
// Wait a random delay of 0-2 seconds to minimize collision
|
findParentNode();
|
||||||
// between ping ack messages from other relaying nodes
|
} else {
|
||||||
delay(millis() & 0x3ff);
|
// Relaying nodes should always answer ping messages
|
||||||
sendWrite(sender, build(msg, nc.nodeId, sender, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT_RESPONSE, false).set(nc.distance), true);
|
// Wait a random delay of 0-2 seconds to minimize collision
|
||||||
|
// between ping ack messages from other relaying nodes
|
||||||
|
delay(millis() & 0x3ff);
|
||||||
|
sendWrite(sender, build(msg, nc.nodeId, sender, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT_RESPONSE, false).set(nc.distance), true);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (destination == nc.nodeId) {
|
} else if (destination == nc.nodeId) {
|
||||||
// Check if sender requests an ack back.
|
// Check if sender requests an ack back.
|
||||||
|
|||||||
Reference in New Issue
Block a user