Skip to content

Commit eacd24f

Browse files
committed
checkConnection verify connection both ways
The checkConnection() function previously only tested connectivity from node->master. This modification tests connectivity node->master->node. This should ensure proper maintenance of the mesh for new users and make things less confusing. Behavior changes a bit, since the test is only performed once, where previously, three attempts were performed. #174 #165 #78
1 parent 7760101 commit eacd24f

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

RF24Mesh.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,8 @@ void RF24Mesh::setChild(bool allow){
138138
/*****************************************************/
139139

140140
bool RF24Mesh::checkConnection(){
141-
142-
uint8_t count = 3;
143-
bool ok = 0;
144-
while(count-- && mesh_address != MESH_DEFAULT_ADDRESS){
145-
update();
146-
if(radio.rxFifoFull() || (network.networkFlags & 1)){
147-
return 1;
148-
}
149-
RF24NetworkHeader header(00,NETWORK_PING);
150-
ok = network.write(header,0,0);
151-
if(ok){break;}
152-
delay(103);
153-
}
154-
if(!ok){ radio.stopListening(); }
155-
return ok;
141+
142+
return (getAddress(_nodeID) >= 0 ? true : false);
156143

157144
}
158145

0 commit comments

Comments
 (0)