Skip to content

Commit 5120aa4

Browse files
committed
0.8.153
* added update warning once 0.9.x should be installed -> not possible using OTA because of changed partition layout * improved CMT communication
1 parent 78cbd77 commit 5120aa4

File tree

5 files changed

+50
-10
lines changed

5 files changed

+50
-10
lines changed

src/CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Development Changes
22

3+
## 0.8.153 - 2025-03-05
4+
* added update warning once 0.9.x should be installed -> not possible using OTA because of changed partition layout
5+
* improved CMT communication
6+
37
## 0.8.152 - 2024-10-07
48
* patching MqTT library to prevent raise conditions while using semaphores
59
* update ESP32 espressif platform to `0.6.9`

src/defines.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//-------------------------------------
1414
#define VERSION_MAJOR 0
1515
#define VERSION_MINOR 8
16-
#define VERSION_PATCH 152
16+
#define VERSION_PATCH 153
1717
//-------------------------------------
1818
typedef struct {
1919
uint8_t ch;

src/hms/cmt2300a.h

+23-6
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,13 @@ enum class CmtStatus : uint8_t {
168168
#define CMT2300A_MASK_PKT_OK_FLG 0x01
169169

170170
class Cmt2300a {
171+
private: /*types*/
172+
static constexpr uint8_t CmtTimeoutMs = 40;
173+
171174
public:
172-
Cmt2300a() {}
175+
Cmt2300a()
176+
: lastMillis {0}
177+
{}
173178

174179
void setup(uint8_t pinSclk, uint8_t pinSdio, uint8_t pinCsb, uint8_t pinFcsb) {
175180
mSpi.init(pinSdio, pinSclk, pinCsb, pinFcsb);
@@ -182,6 +187,7 @@ class Cmt2300a {
182187
if(CMT2300A_MASK_TX_DONE_FLG == mSpi.readReg(CMT2300A_CUS_INT_CLR1)) {
183188
if(cmtSwitchStatus(CMT2300A_GO_STBY, CMT2300A_STA_STBY)) {
184189
mTxPending = false;
190+
lastMillis = 0;
185191
goRx();
186192
}
187193
}
@@ -226,9 +232,6 @@ class Cmt2300a {
226232
}
227233

228234
CmtStatus getRx(uint8_t buf[], uint8_t *rxLen, uint8_t maxlen, int8_t *rssi) {
229-
if(mTxPending)
230-
return CmtStatus::ERR_TX_PENDING;
231-
232235
if(0x1b != (mSpi.readReg(CMT2300A_CUS_INT_FLAG) & 0x1b))
233236
return CmtStatus::FIFO_EMPTY;
234237

@@ -252,8 +255,19 @@ class Cmt2300a {
252255
}
253256

254257
CmtStatus tx(uint8_t buf[], uint8_t len) {
255-
if(mTxPending)
256-
return CmtStatus::ERR_TX_PENDING;
258+
if(mTxPending) {
259+
if(CmtTimeoutMs < (millis() - lastMillis)) {
260+
DPRINT(DBG_ERROR, "CMT, last TX timeout: ");
261+
DBGPRINT(String(millis() - lastMillis));
262+
DBGPRINTLN("ms");
263+
}
264+
265+
while(mTxPending && (CmtTimeoutMs > (millis() - lastMillis))) {
266+
vTaskDelay(10);
267+
}
268+
mTxPending = false;
269+
goRx();
270+
}
257271

258272
if(mInRxMode) {
259273
mInRxMode = false;
@@ -284,6 +298,7 @@ class Cmt2300a {
284298

285299
if(!cmtSwitchStatus(CMT2300A_GO_TX, CMT2300A_STA_TX))
286300
return CmtStatus::ERR_SWITCH_STATE;
301+
lastMillis = millis();
287302

288303
// wait for tx done
289304
mTxPending = true;
@@ -560,6 +575,8 @@ class Cmt2300a {
560575
uint8_t mCusIntFlag = 0;
561576
uint8_t mRqstCh = 0, mCurCh = 0;
562577
RegionCfg mRegionCfg = RegionCfg::EUROPE;
578+
579+
uint32_t lastMillis;
563580
};
564581

565582
#endif /*__CMT2300A_H__*/

src/web/html/update.html

+17-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
}
5151

5252
function hide() {
53-
var bin = document.getElementsByName("update")[0].value.slice(-env.length-4, -4)
53+
let fw = document.getElementsByName("update")[0].value
54+
var bin = fw.slice(-env.length-4, -4)
55+
let ver = fw.split("_")[2].split(".")
5456
if (bin !== env) {
5557
var html = ml("div", {class: "row"}, [
5658
ml("div", {class: "row my-3"}, "{#WARN_DIFF_ENV}"),
@@ -60,8 +62,20 @@
6062
])
6163
])
6264
modal("{#UPDATE_MODAL}", html)
63-
} else
64-
start()
65+
} else {
66+
if(ver[1] != "9")
67+
start()
68+
else {
69+
var html = ml("div", {class: "row"}, [
70+
ml("div", {class: "row my-3"}, "{#ERROR_UPGRADE_NOT_POSSIBLE}"),
71+
ml("div", {class: "row"}, [
72+
ml("div", {class: "col-6"}, ml("input", {type: "button", class: "btn", value: "{#CANCEL}", onclick: function() { modalClose(); }}, null))
73+
])
74+
])
75+
modal("{#UPDATE_MODAL}", html)
76+
}
77+
}
78+
6579
}
6680

6781
function start() {

src/web/lang.json

+5
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,11 @@
13331333
"en": "your environment may not match the update file!",
13341334
"de": "Die ausgew&auml;hlte Firmware passt u.U. nicht zum Chipsatz!"
13351335
},
1336+
{
1337+
"token": "ERROR_UPGRADE_NOT_POSSIBLE",
1338+
"en": "OTA updade to version 0.9.x not possible, partition layout changed",
1339+
"de": "Aktualisierung auf Version 0.9.x nicht per Update m&ouml;glich (Partition Layout ge&auml;ndert), bitte per Websinstaller neu installieren"
1340+
},
13361341
{
13371342
"token": "CONTIUE",
13381343
"en": "continue",

0 commit comments

Comments
 (0)