Skip to content

Commit

Permalink
0.8.44
Browse files Browse the repository at this point in the history
* fix MqTT transmission of data #1326
* live data is read much earlier / faster and more often
  • Loading branch information
lumapu committed Jan 5, 2024
1 parent 21d77f5 commit b4ba35e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
4 changes: 4 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Development Changes

## 0.8.44 - 2024-01-05
* fix MqTT transmission of data #1326
* live data is read much earlier / faster and more often

## 0.8.43 - 2024-01-04
* fix display of sunrise in `/system` #1308
* fix overflow of `getLossRate` calculation #1318
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 8
#define VERSION_PATCH 43
#define VERSION_PATCH 44

//-------------------------------------
typedef struct {
Expand Down
1 change: 1 addition & 0 deletions src/hm/Communication.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ class Communication : public CommQueue<> {
for (uint8_t i = 0; i < rec->length; i++) {
q->iv->addValue(i, mPayload, rec);
}
rec->mqttSentStatus = MqttSentStatus::NEW_DATA;

q->iv->rssi = rssi;
q->iv->doCalculations();
Expand Down
48 changes: 27 additions & 21 deletions src/hm/hmInverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,28 +186,33 @@ class Inverter {
if(mDevControlRequest) {
cb(devControlCmd, true);
mDevControlRequest = false;
} else if (IV_MI != ivGen) {
} else if (IV_MI != ivGen) { // HM / HMS / HMT
mGetLossInterval++;
if((alarmLastId != alarmMesIndex) && (alarmMesIndex != 0))
cb(AlarmData, false); // get last alarms
else if(0 == getFwVersion())
cb(InverterDevInform_All, false); // get firmware version
else if(0 == getHwVersion())
cb(InverterDevInform_Simple, false); // get hardware version
else if(actPowerLimit == 0xffff)
cb(SystemConfigPara, false); // power limit info
else if(InitDataState != devControlCmd) {
cb(devControlCmd, false); // custom command which was received by API
devControlCmd = InitDataState;
mGetLossInterval = 1;
} else if((0 == mGridLen) && generalConfig->readGrid) { // read grid profile
cb(GridOnProFilePara, false);
} else if (mGetLossInterval > AHOY_GET_LOSS_INTERVAL) { // get loss rate
mGetLossInterval = 1;
cb(GetLossRate, false);
} else
if(mNextLive)
cb(RealTimeRunData_Debug, false); // get live data
} else {
else {
mNextLive = true;
if(actPowerLimit == 0xffff)
cb(SystemConfigPara, false); // power limit info
else if(InitDataState != devControlCmd) {
cb(devControlCmd, false); // custom command which was received by API
devControlCmd = InitDataState;
mGetLossInterval = 1;
} else if((alarmLastId != alarmMesIndex) && (alarmMesIndex != 0))
cb(AlarmData, false); // get last alarms
else if(0 == getFwVersion())
cb(InverterDevInform_All, false); // get firmware version
else if(0 == getHwVersion())
cb(InverterDevInform_Simple, false); // get hardware version
else if((0 == mGridLen) && generalConfig->readGrid) { // read grid profile
cb(GridOnProFilePara, false);
} else if (mGetLossInterval > AHOY_GET_LOSS_INTERVAL) { // get loss rate
mGetLossInterval = 1;
cb(GetLossRate, false);
} else
cb(RealTimeRunData_Debug, false); // get live data
}
} else { // MI
if(0 == getFwVersion())
cb(0x0f, false); // get firmware version; for MI, this makes part of polling the device software and hardware version number
else {
Expand Down Expand Up @@ -319,10 +324,10 @@ class Inverter {
rec->record[pos] = (REC_TYP)(val);
}
}
rec->mqttSentStatus = MqttSentStatus::NEW_DATA;
}

if(rec == &recordMeas) {
mNextLive = false; // live data received
DPRINTLN(DBG_VERBOSE, "add real time");
// get last alarm message index and save it in the inverter object
if (getPosByChFld(0, FLD_EVT, rec) == pos) {
Expand Down Expand Up @@ -832,6 +837,7 @@ class Inverter {
uint16_t mIvRxCnt = 0;
uint16_t mIvTxCnt = 0;
uint8_t mAlarmNxtWrPos = 0; // indicates the position in array (rolling buffer)
bool mNextLive = true; // first read live data after booting up then version etc.

public:
uint16_t mDtuRxCnt = 0;
Expand Down

0 comments on commit b4ba35e

Please sign in to comment.