@@ -112,7 +112,7 @@ void MySensor::setupRadio(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_
112
112
RF24::setCRCLength (RF24_CRC_16);
113
113
RF24::enableDynamicPayloads ();
114
114
115
- // All nodes listen to broadcast pipe (for PING-ACK messages)
115
+ // All nodes listen to broadcast pipe (for FIND_PARENT_RESPONSE messages)
116
116
RF24::openReadingPipe (BROADCAST_PIPE, TO_ADDR (BROADCAST_ADDRESS));
117
117
}
118
118
@@ -145,7 +145,7 @@ void MySensor::findParentNode() {
145
145
nc.distance = 255 ;
146
146
147
147
// Send ping message to BROADCAST_ADDRESS (to which all relaying nodes and gateway listens and should reply to)
148
- build (msg, nc.nodeId , BROADCAST_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_PING , false ).set (" " );
148
+ build (msg, nc.nodeId , BROADCAST_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT , false ).set (" " );
149
149
sendWrite (BROADCAST_ADDRESS, msg, true );
150
150
151
151
// Wait for ping response.
@@ -285,12 +285,12 @@ boolean MySensor::process() {
285
285
uint8_t last = msg.last ;
286
286
uint8_t destination = msg.destination ;
287
287
288
- if (repeaterMode && command == C_INTERNAL && type == I_PING ) {
288
+ if (repeaterMode && command == C_INTERNAL && type == I_FIND_PARENT ) {
289
289
// Relaying nodes should always answer ping messages
290
290
// Wait a random delay of 0-2 seconds to minimize collision
291
291
// between ping ack messages from other relaying nodes
292
292
delay (millis () & 0x3ff );
293
- sendWrite (sender, build (msg, nc.nodeId , sender, NODE_SENSOR_ID, C_INTERNAL, I_PING_ACK , false ).set (nc.distance ), true );
293
+ sendWrite (sender, build (msg, nc.nodeId , sender, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT_RESPONSE , false ).set (nc.distance ), true );
294
294
return false ;
295
295
} else if (destination == nc.nodeId ) {
296
296
// Check if sender requests an ack back.
@@ -311,8 +311,8 @@ boolean MySensor::process() {
311
311
}
312
312
313
313
if (command == C_INTERNAL) {
314
- if (type == I_PING_ACK && !isGateway) {
315
- // We've received a reply to a PING message. Check if the distance is
314
+ if (type == I_FIND_PARENT_RESPONSE && !isGateway) {
315
+ // We've received a reply to a FIND_PARENT message. Check if the distance is
316
316
// shorter than we already have.
317
317
uint8_t distance = msg.getByte ();
318
318
if (distance<nc.distance -1 ) {
0 commit comments