From ebb79d1d09904ea8a411c2f95c127f96bcee3ccf Mon Sep 17 00:00:00 2001 From: lumapu Date: Sun, 1 Oct 2023 16:44:20 +0200 Subject: [PATCH] 0.7.63 * fix NRF24 communication #1200 --- src/CHANGES.md | 3 +++ src/app.cpp | 4 ++-- src/defines.h | 2 +- src/hm/hmPayload.h | 2 +- src/hm/hmRadio.h | 6 ++++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index 893b8a3ac..23d17732d 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,8 @@ # Development Changes +## 0.7.63 - 2023-10-01 +* fix NRF24 communication #1200 + ## 0.7.62 - 2023-10-01 * fix communication to inverters #1198 * add timeout before payload is tried to process (necessary for HMS/HMT) diff --git a/src/app.cpp b/src/app.cpp index 762c0c34e..478cd1e51 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -143,9 +143,9 @@ void app::loop(void) { mPayload.add(iv, p); } mNrfRadio.mBufCtrl.pop(); + processPayload = true; yield(); } - processPayload = true; mMiPayload.process(true); } #if defined(ESP32) @@ -168,9 +168,9 @@ void app::loop(void) { mPayload.add(iv, p); } mCmtRadio.mBufCtrl.pop(); + processPayload = true; yield(); } - processPayload = true; } #endif diff --git a/src/defines.h b/src/defines.h index 98b9a7266..5938213a3 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 7 -#define VERSION_PATCH 62 +#define VERSION_PATCH 63 //------------------------------------- typedef struct { diff --git a/src/hm/hmPayload.h b/src/hm/hmPayload.h index bf3d3c663..aa8d10906 100644 --- a/src/hm/hmPayload.h +++ b/src/hm/hmPayload.h @@ -249,7 +249,7 @@ class HmPayload { } if((IV_HMS == iv->ivGen) || (IV_HMT == iv->ivGen)) { - if((mPayload[iv->id].sendMillis + 500) > millis()) + if((mPayload[iv->id].sendMillis + 400) > millis()) return; // to fast, wait until packets are received! } diff --git a/src/hm/hmRadio.h b/src/hm/hmRadio.h index 9e0155649..f037763eb 100644 --- a/src/hm/hmRadio.h +++ b/src/hm/hmRadio.h @@ -57,6 +57,7 @@ class HmRadio : public Radio { pinMode(irq, INPUT_PULLUP); generateDtuSn(); + DTU_RADIO_ID = ((uint64_t)(((mDtuSn >> 24) & 0xFF) | ((mDtuSn >> 8) & 0xFF00) | ((mDtuSn << 8) & 0xFF0000) | ((mDtuSn << 24) & 0xFF000000)) << 8) | 0x01; #ifdef ESP32 #if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 @@ -81,7 +82,7 @@ class HmRadio : public Radio { mNrf24.enableDynamicPayloads(); mNrf24.setCRCLength(RF24_CRC_16); mNrf24.setAddressWidth(5); - mNrf24.openReadingPipe(1, reinterpret_cast(&mDtuSn)); + mNrf24.openReadingPipe(1, reinterpret_cast(&DTU_RADIO_ID)); // enable all receiving interrupts mNrf24.maskIRQ(false, false, false); @@ -202,7 +203,7 @@ class HmRadio : public Radio { std::queue mBufCtrl; private: - bool getReceived(void) { + inline bool getReceived(void) { bool tx_ok, tx_fail, rx_ready; mNrf24.whatHappened(tx_ok, tx_fail, rx_ready); // resets the IRQ pin to HIGH @@ -262,6 +263,7 @@ class HmRadio : public Radio { return iv->radioId.u64; } + uint64_t DTU_RADIO_ID; uint8_t mRfChLst[RF_CHANNELS]; uint8_t mTxChIdx; uint8_t mRxChIdx;