* fix communication to inverters #1198
This commit is contained in:
lumapu 2023-10-01 12:12:21 +02:00
parent 5a01cc86e6
commit dae638f7c6
8 changed files with 15 additions and 21 deletions

View file

@ -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`

View file

@ -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) {

View file

@ -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();

View file

@ -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;

View file

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

View file

@ -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;

View file

@ -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) {

View file

@ -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 "));