Auto resend on NACK
-
@mfalkvidd Thank you so much for the explanation! I feel I'm getting a grasp on things.
-
@mfalkvidd said in Auto resend on NACK:
Would someone be kind enough to point me in the direction of a good software acknowledgement example? I've been building MySensors for 4 years and still have sensors that don't send reliable messages. While most have been replaced with ESP's - these sensors are extremely remote and battery powered (MySensors wins here!).
Currently I use:
void resend(MyMessage &msg, int repeats) { int repeat = 1; const int repeatDelay = 100; boolean sendOK = false; while ((sendOK == false) and (repeat <= repeats)) { if (send(msg) == true) { sendOK = true; } else { sendOK = false; #ifdef MY_DEBUG Serial.print(F("Send error: ")); Serial.println(repeat); #endif repeat++; wait(repeatDelay); } } }But this doesn't seem to ensure reliable delivery (some nodes send 10 msgs before sleeping). Often I get multiple messages arriving (I assume this is the burst), but some (often vital) never make it.
-
You will get multiple messages, if the message arrives correctly but the hardware ACK doesn't.
Do you have a repeater in between the sender and gateway? It could be that the repeater does receive the initial message (and the sensor gets a hardware ACK), but that never reaches the gateway because of a transmission error between the repeater and the gateway.