diff --git a/ampel-firmware/lorawan.cpp b/ampel-firmware/lorawan.cpp index 9b667986994246283482d7f1032fba2e86a4d991..c64819b38d023eac6bab5acb67f9a1f92f39fd5b 100644 --- a/ampel-firmware/lorawan.cpp +++ b/ampel-firmware/lorawan.cpp @@ -59,7 +59,13 @@ namespace lorawan { // Reset the MAC state. Session and pending data transfers will be discarded. LMIC_reset(); // Join, but don't send anything yet. - LMIC_startJoining(); + if (config::lora_session_saved) { + LMIC_setSession(config::lora_netid, config::lora_devaddr, (unsigned char*) config::lorawan_nwk_key, + (unsigned char*) config::lorawan_art_key); + connected = true; // Well, hopefully. + } else { + LMIC_startJoining(); + } sensor_console::defineIntCommand("lora", setLoRaInterval, F("300 (Sets LoRaWAN sending interval, in s)")); }