Skip to content

Commit

Permalink
0.7.62
Browse files Browse the repository at this point in the history
* fix communication to inverters #1198
  • Loading branch information
lumapu committed Oct 1, 2023
1 parent 5a01cc8 commit dae638f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 21 deletions.
3 changes: 3 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 1 addition & 1 deletion src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 1 addition & 8 deletions src/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class app : public IApp, public ah::Scheduler {
#endif
}
}

#ifdef ESP32
void handleHmsIntr(void) {
mCmtRadio.handleIntr();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/appInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 7
#define VERSION_PATCH 61
#define VERSION_PATCH 62

//-------------------------------------
typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion src/hm/hmRadio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/hm/radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/hms/hmsRadio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 "));
Expand Down

0 comments on commit dae638f

Please sign in to comment.