From a3e808caaa1e6bc4dd62ae49d59edf056f7f9805 Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Wed, 16 Feb 2022 17:03:09 +0100
Subject: [PATCH] Note

---
 ampel-firmware/lorawan.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ampel-firmware/lorawan.cpp b/ampel-firmware/lorawan.cpp
index c64819b..818c81c 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: "));
-- 
GitLab