diff --git a/tasmota/tasmota_xdrv_driver/xdrv_73_8_lorawan_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_73_8_lorawan_bridge.ino index 84497f0ed..8d7080a29 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_73_8_lorawan_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_73_8_lorawan_bridge.ino @@ -161,6 +161,16 @@ void LoraWanDeleteData(void) { UfsJsonSettingsDelete(key); // Use defaults } } + +uint32_t LoraWanGetCfgCrc(void) { + uint32_t crc32 = 0; + for (uint32_t n = 0; n < Lora->nodes; n++) { + if (Lora->settings.end_node[n]->AppKey[0] > 0) { // Only save used slots + crc32 += GetCfgCrc32((uint8_t*)Lora->settings.end_node[n], sizeof(LoraEndNode_t)); + } + } + return crc32; +} #endif // USE_UFILESYS /*********************************************************************************************/ diff --git a/tasmota/tasmota_xdrv_driver/xdrv_73_9_lora.ino b/tasmota/tasmota_xdrv_driver/xdrv_73_9_lora.ino index 80c1b5d19..559c6cff6 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_73_9_lora.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_73_9_lora.ino @@ -176,6 +176,9 @@ void LoraSettingsSave(void) { // Called from FUNC_SAVE_SETTINGS every SaveData second and at restart #ifdef USE_UFILESYS uint32_t crc32 = GetCfgCrc32((uint8_t*)&Lora->settings +4, sizeof(LoraSettings_t) -4); // Skip crc32 +#ifdef USE_LORAWAN_BRIDGE + crc32 += LoraWanGetCfgCrc(); +#endif // USE_LORAWAN_BRIDGE if (crc32 != Lora->settings.crc32) { Lora->settings.crc32 = crc32; if (LoraSaveData()) {