Reset WAN when new key in the parameters

pull/30/head
Pawel Jalocha 2020-10-09 17:17:44 +01:00
rodzic e9caf1f353
commit 72727b2911
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -66,9 +66,9 @@ 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(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
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
CONS_UART_SetBaudrate(Parameters.CONbaud);