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)) {