From d92918c80a3f3a846b823c42dc3556fac903a318 Mon Sep 17 00:00:00 2001 From: Marcelo Aquino Date: Wed, 11 Feb 2015 12:22:27 -0200 Subject: [PATCH] Accept a new parent only when autoFindParent is 1 In a gateway, I_FIND_PARENT_RESPONSE messages was returning as true by process(). With this commit it will return as false, is this the right expected behavior? --- libraries/MySensors/MyGateway.cpp | 1 + libraries/MySensors/MySensor.cpp | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libraries/MySensors/MyGateway.cpp b/libraries/MySensors/MyGateway.cpp index 909112e..c65978f 100644 --- a/libraries/MySensors/MyGateway.cpp +++ b/libraries/MySensors/MyGateway.cpp @@ -37,6 +37,7 @@ void MyGateway::begin(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e da Serial.begin(BAUD_RATE); repeaterMode = true; isGateway = true; + autoFindParent = false; setupRepeaterMode(); if (inDataCallback != NULL) { diff --git a/libraries/MySensors/MySensor.cpp b/libraries/MySensors/MySensor.cpp index a2a63b5..955ea98 100755 --- a/libraries/MySensors/MySensor.cpp +++ b/libraries/MySensors/MySensor.cpp @@ -300,17 +300,19 @@ boolean MySensor::process() { } 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 - // shorter than we already have. - uint8_t distance = msg.getByte(); - if (distance