Browse Source

0.7.63

* fix NRF24 communication #1200
pull/1219/head
lumapu 1 year ago
parent
commit
ebb79d1d09
  1. 3
      src/CHANGES.md
  2. 4
      src/app.cpp
  3. 2
      src/defines.h
  4. 2
      src/hm/hmPayload.h
  5. 6
      src/hm/hmRadio.h

3
src/CHANGES.md

@ -1,5 +1,8 @@
# Development Changes # Development Changes
## 0.7.63 - 2023-10-01
* fix NRF24 communication #1200
## 0.7.62 - 2023-10-01 ## 0.7.62 - 2023-10-01
* fix communication to inverters #1198 * fix communication to inverters #1198
* add timeout before payload is tried to process (necessary for HMS/HMT) * add timeout before payload is tried to process (necessary for HMS/HMT)

4
src/app.cpp

@ -143,9 +143,9 @@ void app::loop(void) {
mPayload.add(iv, p); mPayload.add(iv, p);
} }
mNrfRadio.mBufCtrl.pop(); mNrfRadio.mBufCtrl.pop();
processPayload = true;
yield(); yield();
} }
processPayload = true;
mMiPayload.process(true); mMiPayload.process(true);
} }
#if defined(ESP32) #if defined(ESP32)
@ -168,9 +168,9 @@ void app::loop(void) {
mPayload.add(iv, p); mPayload.add(iv, p);
} }
mCmtRadio.mBufCtrl.pop(); mCmtRadio.mBufCtrl.pop();
processPayload = true;
yield(); yield();
} }
processPayload = true;
} }
#endif #endif

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 7 #define VERSION_MINOR 7
#define VERSION_PATCH 62 #define VERSION_PATCH 63
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

2
src/hm/hmPayload.h

@ -249,7 +249,7 @@ class HmPayload {
} }
if((IV_HMS == iv->ivGen) || (IV_HMT == iv->ivGen)) { 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! return; // to fast, wait until packets are received!
} }

6
src/hm/hmRadio.h

@ -57,6 +57,7 @@ class HmRadio : public Radio {
pinMode(irq, INPUT_PULLUP); pinMode(irq, INPUT_PULLUP);
generateDtuSn(); generateDtuSn();
DTU_RADIO_ID = ((uint64_t)(((mDtuSn >> 24) & 0xFF) | ((mDtuSn >> 8) & 0xFF00) | ((mDtuSn << 8) & 0xFF0000) | ((mDtuSn << 24) & 0xFF000000)) << 8) | 0x01;
#ifdef ESP32 #ifdef ESP32
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 #if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
@ -81,7 +82,7 @@ class HmRadio : public Radio {
mNrf24.enableDynamicPayloads(); mNrf24.enableDynamicPayloads();
mNrf24.setCRCLength(RF24_CRC_16); mNrf24.setCRCLength(RF24_CRC_16);
mNrf24.setAddressWidth(5); mNrf24.setAddressWidth(5);
mNrf24.openReadingPipe(1, reinterpret_cast<uint8_t*>(&mDtuSn)); mNrf24.openReadingPipe(1, reinterpret_cast<uint8_t*>(&DTU_RADIO_ID));
// enable all receiving interrupts // enable all receiving interrupts
mNrf24.maskIRQ(false, false, false); mNrf24.maskIRQ(false, false, false);
@ -202,7 +203,7 @@ class HmRadio : public Radio {
std::queue<packet_t> mBufCtrl; std::queue<packet_t> mBufCtrl;
private: private:
bool getReceived(void) { inline bool getReceived(void) {
bool tx_ok, tx_fail, rx_ready; bool tx_ok, tx_fail, rx_ready;
mNrf24.whatHappened(tx_ok, tx_fail, rx_ready); // resets the IRQ pin to HIGH 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; return iv->radioId.u64;
} }
uint64_t DTU_RADIO_ID;
uint8_t mRfChLst[RF_CHANNELS]; uint8_t mRfChLst[RF_CHANNELS];
uint8_t mTxChIdx; uint8_t mTxChIdx;
uint8_t mRxChIdx; uint8_t mRxChIdx;

Loading…
Cancel
Save