From c18ed3468572802fcfcb690566bbbe0642a994fa Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 20 Mar 2024 18:18:31 +0100 Subject: [PATCH] Fix Lora watchdog - Update file JSON settings demo --- lib/lib_rf/LoRa/src/LoRa.cpp | 3 +- .../xdrv_122_file_json_settings_demo.ino | 28 +------------------ 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/lib/lib_rf/LoRa/src/LoRa.cpp b/lib/lib_rf/LoRa/src/LoRa.cpp index a16e55ea3e19..0a6332fc3b21 100644 --- a/lib/lib_rf/LoRa/src/LoRa.cpp +++ b/lib/lib_rf/LoRa/src/LoRa.cpp @@ -197,7 +197,8 @@ int LoRaClass::endPacket(bool async) if (!async) { // wait for TX done while ((readRegister(REG_IRQ_FLAGS) & IRQ_TX_DONE_MASK) == 0) { - yield(); +// yield(); + delay(0); // Prevent watchdog crashes } // clear IRQ's writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_122_file_json_settings_demo.ino b/tasmota/tasmota_xdrv_driver/xdrv_122_file_json_settings_demo.ino index 965824f90ff4..47bb0a16e81a 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_122_file_json_settings_demo.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_122_file_json_settings_demo.ino @@ -34,12 +34,9 @@ #define DRV_DEMO_MAX_DRV_TEXT 16 -const uint16_t DRV_DEMO_VERSION = 0x0105; // Latest driver version (See settings deltas below) - // Global structure containing driver saved variables struct { uint32_t crc32; // To detect file changes - uint16_t version; // To detect driver function changes char drv_text[DRV_DEMO_MAX_DRV_TEXT][10]; } DrvDemoSettings; @@ -65,7 +62,6 @@ bool DrvDemoLoadData(void) { if (!root) { return false; } DrvDemoSettings.crc32 = root.getUInt(PSTR("Crc"), DrvDemoSettings.crc32); - DrvDemoSettings.version = root.getUInt(PSTR("Version"), DrvDemoSettings.version); JsonParserArray arr = root[PSTR("Text")]; if (arr) { for (uint32_t i = 0; i < DRV_DEMO_MAX_DRV_TEXT; i++) { @@ -80,10 +76,8 @@ bool DrvDemoLoadData(void) { bool DrvDemoSaveData(void) { Response_P(PSTR("{\"" XDRV_122_KEY "\":{" "\"Crc\":%u," - "\"Version\":%u," "\"Text\":["), - DrvDemoSettings.crc32, - DrvDemoSettings.version); + DrvDemoSettings.crc32); for (uint32_t i = 0; i < DRV_DEMO_MAX_DRV_TEXT; i++) { ResponseAppend_P(PSTR("%s\"%s\""), (i)?",":"", @@ -109,7 +103,6 @@ void DrvDemoSettingsLoad(bool erase) { AddLog(LOG_LEVEL_INFO, PSTR("DRV: " D_USE_DEFAULTS)); memset(&DrvDemoSettings, 0x00, sizeof(DrvDemoSettings)); - DrvDemoSettings.version = DRV_DEMO_VERSION; // Init any other parameter in struct DrvDemoSettings snprintf_P(DrvDemoSettings.drv_text[0], sizeof(DrvDemoSettings.drv_text[0]), PSTR("Azalea")); @@ -123,25 +116,6 @@ void DrvDemoSettingsLoad(bool erase) { DrvDemoDeleteData(); } else if (DrvDemoLoadData()) { - if (DrvDemoSettings.version != DRV_DEMO_VERSION) { // Fix version dependent changes - - // *** Start fix possible setting deltas *** - if (DrvDemoSettings.version < 0x0103) { - AddLog(LOG_LEVEL_INFO, PSTR("CFG: Update oldest version restore")); - - snprintf_P(DrvDemoSettings.drv_text[1], sizeof(DrvDemoSettings.drv_text[1]), PSTR("Begonia")); - } - if (DrvDemoSettings.version < 0x0104) { - AddLog(LOG_LEVEL_INFO, PSTR("CFG: Update old version restore")); - - } - - // *** End setting deltas *** - - // Set current version and save settings - DrvDemoSettings.version = DRV_DEMO_VERSION; - DrvDemoSettingsSave(); - } AddLog(LOG_LEVEL_INFO, PSTR("CFG: Demo loaded from file")); } else {