diff --git a/src/CHANGES.md b/src/CHANGES.md index bc419068..11cd7393 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,9 @@ # Development Changes +## 0.8.153 - 2025-03-05 +* added update warning once 0.9.x should be installed -> not possible using OTA because of changed partition layout +* improved CMT communication + ## 0.8.152 - 2024-10-07 * patching MqTT library to prevent raise conditions while using semaphores * update ESP32 espressif platform to `0.6.9` diff --git a/src/defines.h b/src/defines.h index 1f3d013c..105220cf 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 152 +#define VERSION_PATCH 153 //------------------------------------- typedef struct { uint8_t ch; diff --git a/src/hms/cmt2300a.h b/src/hms/cmt2300a.h index 626d3e79..ece6fbc3 100644 --- a/src/hms/cmt2300a.h +++ b/src/hms/cmt2300a.h @@ -168,8 +168,13 @@ enum class CmtStatus : uint8_t { #define CMT2300A_MASK_PKT_OK_FLG 0x01 class Cmt2300a { + private: /*types*/ + static constexpr uint8_t CmtTimeoutMs = 40; + public: - Cmt2300a() {} + Cmt2300a() + : lastMillis {0} + {} void setup(uint8_t pinSclk, uint8_t pinSdio, uint8_t pinCsb, uint8_t pinFcsb) { mSpi.init(pinSdio, pinSclk, pinCsb, pinFcsb); @@ -182,6 +187,7 @@ class Cmt2300a { if(CMT2300A_MASK_TX_DONE_FLG == mSpi.readReg(CMT2300A_CUS_INT_CLR1)) { if(cmtSwitchStatus(CMT2300A_GO_STBY, CMT2300A_STA_STBY)) { mTxPending = false; + lastMillis = 0; goRx(); } } @@ -226,9 +232,6 @@ class Cmt2300a { } CmtStatus getRx(uint8_t buf[], uint8_t *rxLen, uint8_t maxlen, int8_t *rssi) { - if(mTxPending) - return CmtStatus::ERR_TX_PENDING; - if(0x1b != (mSpi.readReg(CMT2300A_CUS_INT_FLAG) & 0x1b)) return CmtStatus::FIFO_EMPTY; @@ -252,8 +255,19 @@ class Cmt2300a { } CmtStatus tx(uint8_t buf[], uint8_t len) { - if(mTxPending) - return CmtStatus::ERR_TX_PENDING; + if(mTxPending) { + if(CmtTimeoutMs < (millis() - lastMillis)) { + DPRINT(DBG_ERROR, "CMT, last TX timeout: "); + DBGPRINT(String(millis() - lastMillis)); + DBGPRINTLN("ms"); + } + + while(mTxPending && (CmtTimeoutMs > (millis() - lastMillis))) { + vTaskDelay(10); + } + mTxPending = false; + goRx(); + } if(mInRxMode) { mInRxMode = false; @@ -284,6 +298,7 @@ class Cmt2300a { if(!cmtSwitchStatus(CMT2300A_GO_TX, CMT2300A_STA_TX)) return CmtStatus::ERR_SWITCH_STATE; + lastMillis = millis(); // wait for tx done mTxPending = true; @@ -560,6 +575,8 @@ class Cmt2300a { uint8_t mCusIntFlag = 0; uint8_t mRqstCh = 0, mCurCh = 0; RegionCfg mRegionCfg = RegionCfg::EUROPE; + + uint32_t lastMillis; }; #endif /*__CMT2300A_H__*/ diff --git a/src/web/html/update.html b/src/web/html/update.html index 4b670d45..410fe452 100644 --- a/src/web/html/update.html +++ b/src/web/html/update.html @@ -50,7 +50,9 @@ } function hide() { - var bin = document.getElementsByName("update")[0].value.slice(-env.length-4, -4) + let fw = document.getElementsByName("update")[0].value + var bin = fw.slice(-env.length-4, -4) + let ver = fw.split("_")[2].split(".") if (bin !== env) { var html = ml("div", {class: "row"}, [ ml("div", {class: "row my-3"}, "{#WARN_DIFF_ENV}"), @@ -60,8 +62,20 @@ ]) ]) modal("{#UPDATE_MODAL}", html) - } else - start() + } else { + if(ver[1] != "9") + start() + else { + var html = ml("div", {class: "row"}, [ + ml("div", {class: "row my-3"}, "{#ERROR_UPGRADE_NOT_POSSIBLE}"), + ml("div", {class: "row"}, [ + ml("div", {class: "col-6"}, ml("input", {type: "button", class: "btn", value: "{#CANCEL}", onclick: function() { modalClose(); }}, null)) + ]) + ]) + modal("{#UPDATE_MODAL}", html) + } + } + } function start() { diff --git a/src/web/lang.json b/src/web/lang.json index a1f15451..96f60a54 100644 --- a/src/web/lang.json +++ b/src/web/lang.json @@ -1333,6 +1333,11 @@ "en": "your environment may not match the update file!", "de": "Die ausgewählte Firmware passt u.U. nicht zum Chipsatz!" }, + { + "token": "ERROR_UPGRADE_NOT_POSSIBLE", + "en": "OTA updade to version 0.9.x not possible, partition layout changed", + "de": "Aktualisierung auf Version 0.9.x nicht per Update möglich (Partition Layout geändert), bitte per Websinstaller neu installieren" + }, { "token": "CONTIUE", "en": "continue",