From f4543b79b66f708424ac001bb897e2ad5a4438b9 Mon Sep 17 00:00:00 2001 From: Matthias Prinke <83612361+matthias-bs@users.noreply.github.com> Date: Wed, 5 Jun 2024 20:08:14 +0200 Subject: [PATCH] Moved node.beginOTAA() before recalling LoRaWAN nonces & session (#53) --- BresserWeatherSensorLW.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BresserWeatherSensorLW.ino b/BresserWeatherSensorLW.ino index e19b5b7..4b1b21c 100644 --- a/BresserWeatherSensorLW.ino +++ b/BresserWeatherSensorLW.ino @@ -782,6 +782,9 @@ void setup() state = radio.begin(); debug(state != RADIOLIB_ERR_NONE, "Initalise radio failed", state, true); + // Setup the OTAA session information + node.beginOTAA(joinEUI, devEUI, nwkKey, appKey); + log_d("Recalling LoRaWAN nonces & session"); // ##### setup the flash storage store.begin("radiolib"); @@ -802,9 +805,6 @@ void setup() // LWsession var. At this point, bootCount has already been incremented, hence the > 2 debug((state != RADIOLIB_ERR_NONE) && (bootCount > 2), "Restoring session buffer failed", state, false); - // Setup the OTAA session information - node.beginOTAA(joinEUI, devEUI, nwkKey, appKey); - // loop until successful join while ((state != RADIOLIB_LORAWAN_NEW_SESSION) && (state != RADIOLIB_LORAWAN_SESSION_RESTORED)) {