Skip to content

Commit 18848a2

Browse files
committed
Renamed defines.
1 parent a4aabb9 commit 18848a2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

libraries/MySensors/Sensor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void Sensor::findRelay() {
122122
distance = 255;
123123
uint8_t oldRelayId = relayId;
124124
uint8_t retries=0;
125-
while (distance == 255 && retries<3) {
125+
while (distance == 255 && retries<FIND_RELAY_RETRIES) {
126126
// Send ping message to BROADCAST_ADDRESS (to which all nodes listens and should reply to)
127127
buildMsg(radioId, BROADCAST_ADDRESS, NODE_CHILD_ID, M_INTERNAL, I_PING, "", 0, false);
128128
sendWrite(BROADCAST_ADDRESS, msg, 0);
@@ -206,7 +206,7 @@ boolean Sensor::send(message_s message, int length) {
206206
if (!ok && radioId != GATEWAY_ADDRESS) {
207207
// Failure when sending to relay node. The relay node might be down and we
208208
// need to find another route to gateway. Max 20 retries before giving up.
209-
if (failedTransmissions > FIND_RELAY_RETRIES) {
209+
if (failedTransmissions > FIND_RELAY_AFTER_FAILED_TRANSMISSIONS) {
210210
findRelay();
211211
}
212212
failedTransmissions++;

libraries/MySensors/Sensor.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
#define CURRENT_NODE_PIPE ((uint8_t)1)
5151
#define BROADCAST_PIPE ((uint8_t)2)
5252

53-
#define FIND_RELAY_RETRIES 3
53+
#define FIND_RELAY_RETRIES 2
54+
#define FIND_RELAY_AFTER_FAILED_TRANSMISSIONS 20
5455

5556

5657
#define MAX_MESSAGE_LENGTH 32

0 commit comments

Comments
 (0)