From 87fc27cc220d64460b26c7364806a4fa4e5a00ec Mon Sep 17 00:00:00 2001 From: Pawel Jalocha Date: Fri, 16 Oct 2020 00:19:01 +0100 Subject: [PATCH] Re-init LoRaWAN when the AppKey changes --- main/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/main.cpp b/main/main.cpp index 2f804ef..16de427 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -66,7 +66,7 @@ void app_main(void) WANdev.Reset(getUniqueID(), Parameters.AppKey); // set default LoRaWAN config. if(WANdev.ReadFromNVS()!=ESP_OK) // if can't read the LoRaWAN setup from NVS { WANdev.WriteToNVS(); } // then store the default - if(WANdev.State<2 && memcmp(WANdev.AppKey, Parameters.AppKey, 16)) // if LoRaWAN key different from the one in Parameters + if( /* WANdev.State<2 && */ memcmp(WANdev.AppKey, Parameters.AppKey, 16)) // if LoRaWAN key different from the one in Parameters { WANdev.Reset(getUniqueID(), Parameters.AppKey); // then reset LoRaWAN to this key WANdev.WriteToNVS(); } // and save LoRaWAN config. to NVS #endif