From dae638f7c6b56a91e36b5c08b5d4f8b7e1dbd250 Mon Sep 17 00:00:00 2001 From: lumapu Date: Sun, 1 Oct 2023 12:12:21 +0200 Subject: [PATCH] 0.7.62 * fix communication to inverters #1198 --- src/CHANGES.md | 3 +++ src/app.cpp | 2 +- src/app.h | 9 +-------- src/appInterface.h | 2 -- src/defines.h | 2 +- src/hm/hmRadio.h | 2 +- src/hm/radio.h | 14 +++++++------- src/hms/hmsRadio.h | 2 +- 8 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index 89f334cc..0f2bdda4 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,8 @@ # Development Changes +## 0.7.62 - 2023-10-01 +* fix communication to inverters #1198 + ## 0.7.61 - 2023-10-01 * merged `hmPayload` and `hmsPayload` into single class * merged generic radio functions into new parent class `radio.h` diff --git a/src/app.cpp b/src/app.cpp index a58ae877..14c22e18 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -394,9 +394,9 @@ void app::tickSend(void) { if(mConfig->nrf.enabled) { if(!mNrfRadio.isChipConnected()) { DPRINTLN(DBG_WARN, F("NRF24 not connected!")); - return; } } + if (mIVCommunicationOn) { if (!mNrfRadio.mBufCtrl.empty()) { if (mConfig->serial.debug) { diff --git a/src/app.h b/src/app.h index 942848da..72fdbf44 100644 --- a/src/app.h +++ b/src/app.h @@ -80,6 +80,7 @@ class app : public IApp, public ah::Scheduler { #endif } } + #ifdef ESP32 void handleHmsIntr(void) { mCmtRadio.handleIntr(); @@ -125,14 +126,6 @@ class app : public IApp, public ah::Scheduler { return mSaveReboot; } - statistics_t *getNrfStatistics() { - return &mNrfStat; - } - - statistics_t *getCmtStatistics() { - return &mCmtStat; - } - #if !defined(ETHERNET) void scanAvailNetworks() { mWifi.scanAvailNetworks(); diff --git a/src/appInterface.h b/src/appInterface.h index e301bc89..d3bc8346 100644 --- a/src/appInterface.h +++ b/src/appInterface.h @@ -32,8 +32,6 @@ class IApp { virtual bool getShouldReboot() = 0; virtual void setRebootFlag() = 0; virtual const char *getVersion() = 0; - virtual statistics_t *getNrfStatistics() = 0; - virtual statistics_t *getCmtStatistics() = 0; #if !defined(ETHERNET) virtual void scanAvailNetworks() = 0; diff --git a/src/defines.h b/src/defines.h index b7b53887..98b9a726 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 7 -#define VERSION_PATCH 61 +#define VERSION_PATCH 62 //------------------------------------- typedef struct { diff --git a/src/hm/hmRadio.h b/src/hm/hmRadio.h index a808bd88..ed9652bc 100644 --- a/src/hm/hmRadio.h +++ b/src/hm/hmRadio.h @@ -232,7 +232,7 @@ class HmRadio : public Radio { } void sendPacket(Inverter<> *iv, uint8_t len, bool isRetransmit, bool appendCrc16=true) { - updateCrcs(len, appendCrc16); + updateCrcs(&len, appendCrc16); // set TX and RX channels mTxChIdx = (mTxChIdx + 1) % RF_CHANNELS; diff --git a/src/hm/radio.h b/src/hm/radio.h index e9b1e47b..1a785318 100644 --- a/src/hm/radio.h +++ b/src/hm/radio.h @@ -64,17 +64,17 @@ class Radio { memset(&mTxBuf[10], 0x00, (MAX_RF_PAYLOAD_SIZE-10)); } - void updateCrcs(uint8_t len, bool appendCrc16=true) { + void updateCrcs(uint8_t *len, bool appendCrc16=true) { // append crc's - if (appendCrc16 && (len > 10)) { + if (appendCrc16 && (*len > 10)) { // crc control data - uint16_t crc = ah::crc16(&mTxBuf[10], len - 10); - mTxBuf[len++] = (crc >> 8) & 0xff; - mTxBuf[len++] = (crc ) & 0xff; + uint16_t crc = ah::crc16(&mTxBuf[10], *len - 10); + mTxBuf[(*len)++] = (crc >> 8) & 0xff; + mTxBuf[(*len)++] = (crc ) & 0xff; } // crc over all - mTxBuf[len] = ah::crc8(mTxBuf, len); - len++; + mTxBuf[*len] = ah::crc8(mTxBuf, *len); + (*len)++; } void generateDtuSn(void) { diff --git a/src/hms/hmsRadio.h b/src/hms/hmsRadio.h index b6b6bb48..1ea94c0d 100644 --- a/src/hms/hmsRadio.h +++ b/src/hms/hmsRadio.h @@ -82,7 +82,7 @@ class CmtRadio : public Radio { private: void sendPacket(Inverter<> *iv, uint8_t len, bool isRetransmit, bool appendCrc16=true) { - updateCrcs(len, appendCrc16); + updateCrcs(&len, appendCrc16); if(mSerialDebug) { DPRINT(DBG_INFO, F("TX "));