From dd81345d416bbbf65dab0a3c4789aa7d845b0a95 Mon Sep 17 00:00:00 2001 From: Hasnain Virk Date: Fri, 4 Jan 2019 02:08:12 +0200 Subject: [PATCH] Randomizing backoff for Join process Randomizing backoff by 200ms to 1000ms for Join Requests in a dense network will add robustness and better chances of reception by the base station especially in cases of catastrophic network outage and reconnection. --- features/lorawan/lorastack/phy/LoRaPHY.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/lorawan/lorastack/phy/LoRaPHY.cpp b/features/lorawan/lorastack/phy/LoRaPHY.cpp index 29414ee7aa..1e6cc64169 100644 --- a/features/lorawan/lorastack/phy/LoRaPHY.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHY.cpp @@ -282,6 +282,8 @@ lorawan_time_t LoRaPHY::update_band_timeoff(bool joined, bool duty_cycle, if (bands[i].off_time != 0) { next_tx_delay = MIN(bands[i].off_time - txDoneTime, next_tx_delay); + // add a random delay from 200ms to a 1000ms + next_tx_delay += (rand() % 800 + 200); } } else { // if network has been joined