diff --git a/ampel-firmware/lorawan.cpp b/ampel-firmware/lorawan.cpp index c64819b38d023eac6bab5acb67f9a1f92f39fd5b..818c81c086f3ba8e9a5b274c2f25115dc6ebf9c9 100644 --- a/ampel-firmware/lorawan.cpp +++ b/ampel-firmware/lorawan.cpp @@ -104,13 +104,21 @@ namespace lorawan { u1_t nwkKey[16]; u1_t artKey[16]; LMIC_getSessionKeys(&netid, &devaddr, nwkKey, artKey); + /** + * NOTE: This is experimental. Saving session to EEPROM seems like a good idea at first, + * to avoid joining every time the Ampel is started. + * But many other infos are needed too (e.g. a counter), and it wouldn't be wise + * to save the whole configuration every time data is sent via EEPROM. + * + * config::lora_session_saved can be set to false, and the Ampel will try to join again next time. + */ config::lora_session_saved = true; config::lora_netid = netid; config::lora_devaddr = devaddr; memcpy(config::lorawan_nwk_key, nwkKey, 16); memcpy(config::lorawan_art_key, artKey, 16); config::save(); - //NOTE: Saving session to EEPROM seems like a good idea at first, but unfortunately: too much info is needed, and a counter would need to be save every single time data is sent. + Serial.print(F(" netid: ")); Serial.println(netid, DEC); Serial.print(F(" devaddr: "));