From 652d589fe3c339c9d6b4dd5a445d1570d7248d67 Mon Sep 17 00:00:00 2001 From: Marcelo Aquino Date: Wed, 11 Feb 2015 10:49:05 -0200 Subject: [PATCH] add node to routing table before send an ack --- libraries/MySensors/MySensor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libraries/MySensors/MySensor.cpp b/libraries/MySensors/MySensor.cpp index a2a63b5..e63372b 100755 --- a/libraries/MySensors/MySensor.cpp +++ b/libraries/MySensors/MySensor.cpp @@ -282,6 +282,13 @@ boolean MySensor::process() { uint8_t destination = msg.destination; if (destination == nc.nodeId) { + // This message is addressed to this node + + if (repeaterMode && last != nc.parentNodeId) { + // Message is from one of the child nodes. Add it to routing table. + addChildRoute(sender, last); + } + // Check if sender requests an ack back. if (mGetRequestAck(msg)) { // Copy message @@ -293,12 +300,6 @@ boolean MySensor::process() { sendRoute(ack); } - // This message is addressed to this node - if (repeaterMode && last != nc.parentNodeId) { - // Message is from one of the child nodes. Add it to routing table. - addChildRoute(sender, last); - } - if (command == C_INTERNAL) { if (type == I_FIND_PARENT_RESPONSE && !isGateway) { // We've received a reply to a FIND_PARENT message. Check if the distance is