Skip to content

Commit

Permalink
0.7.56
Browse files Browse the repository at this point in the history
* only request alarms which were not received before #1113
* added flag if alarm was requested but not received and re-request it #1105
  • Loading branch information
lumapu committed Sep 17, 2023
1 parent 882e96b commit cefcc9c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 13 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.7.56 - 2023-09-17
* only request alarms which were not received before #1113
* added flag if alarm was requested but not received and re-request it #1105

## 0.7.55 - 2023-09-17
* fix prometheus builds
* fix ESP32 default pinout #1159
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 55
#define VERSION_PATCH 56

//-------------------------------------
typedef struct {
Expand Down
10 changes: 9 additions & 1 deletion src/hm/hmInverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,14 @@ class Inverter {
record_t<REC_TYP> recordHwInfo; // structure for simple (hardware) info values
record_t<REC_TYP> recordConfig; // structure for system config values
record_t<REC_TYP> recordAlarm; // structure for alarm values
//String lastAlarmMsg;
bool initialized; // needed to check if the inverter was correctly added (ESP32 specific - union types are never null)
bool isConnected; // shows if inverter was successfully identified (fw version and hardware info)
InverterStatus status; // indicates the current inverter status
std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms
uint8_t alarmNxtWrPos; // indicates the position in array (rolling buffer)
uint16_t alarmCnt; // counts the total number of occurred alarms
uint8_t alarmLastId; // lastId which was received
bool alarmReqPending; // alarmData request issued and wait for answer
int8_t rssi; // HMS and HMT inverters only


Expand All @@ -173,6 +174,7 @@ class Inverter {
status = InverterStatus::OFF;
alarmNxtWrPos = 0;
alarmCnt = 0;
alarmLastId = 0;
rssi = -127;
}

Expand Down Expand Up @@ -208,6 +210,8 @@ class Inverter {
enqueCommand<InfoCommand>(InverterDevInform_All); // firmware version
else if (getHwVersion() == 0)
enqueCommand<InfoCommand>(InverterDevInform_Simple); // hardware version
else if(alarmReqPending)
enqueCommand<InfoCommand>(AlarmData); // alarm not answered
enqueCommand<InfoCommand>(RealTimeRunData_Debug); // live data
} else if (ivGen == IV_MI){
if (getFwVersion() == 0) {
Expand Down Expand Up @@ -338,6 +342,7 @@ class Inverter {

DPRINT(DBG_INFO, "alarm ID incremented to ");
DBGPRINTLN(String(alarmMesIndex));
alarmReqPending = true;
enqueCommand<InfoCommand>(AlarmData);
}
}
Expand Down Expand Up @@ -598,6 +603,7 @@ class Inverter {
lastAlarm.fill({0, 0, 0});
alarmNxtWrPos = 0;
alarmCnt = 0;
alarmLastId = 0;
}

uint16_t parseAlarmLog(uint8_t id, uint8_t pyld[], uint8_t len) {
Expand All @@ -620,7 +626,9 @@ class Inverter {
DPRINTLN(DBG_DEBUG, "Alarm #" + String(pyld[startOff+1]) + " '" + String(getAlarmStr(pyld[startOff+1])) + "' start: " + ah::getTimeStr(start) + ", end: " + ah::getTimeStr(endTime));
addAlarm(pyld[startOff+1], start, endTime);

alarmReqPending = false;
alarmCnt++;
alarmLastId = alarmMesIndex;

return pyld[startOff+1];
}
Expand Down
8 changes: 4 additions & 4 deletions src/hm/hmPayload.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class HmPayload {
DPRINT_IVID(DBG_INFO, iv->id);
DBGPRINT(F("prepareDevInformCmd 0x"));
DBGHEXLN(cmd);
mRadio->prepareDevInformCmd(iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmMesIndex, false);
mRadio->prepareDevInformCmd(iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmLastId, false);
mPayload[iv->id].txCmd = cmd;
}
}
Expand Down Expand Up @@ -253,7 +253,7 @@ class HmPayload {
DPRINTLN(DBG_WARN, F("nothing received: Request Complete Retransmit"));
mPayload[iv->id].txCmd = iv->getQueuedCmd();
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") prepareDevInformCmd 0x") + String(mPayload[iv->id].txCmd, HEX));
mRadio->prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex, true);
mRadio->prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmLastId, true);
*/
DPRINT_IVID(DBG_INFO, iv->id);
DBGPRINTLN(F("nothing received"));
Expand Down Expand Up @@ -286,7 +286,7 @@ class HmPayload {
DBGPRINT(F("prepareDevInformCmd 0x"));
DBGHEXLN(mPayload[iv->id].txCmd);
}
mRadio->prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex, true);
mRadio->prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmLastId, true);
}
} else { // payload complete
if (mSerialDebug) {
Expand Down Expand Up @@ -364,7 +364,7 @@ class HmPayload {
DBGHEXLN(cmd);
}
mStat->rxSuccess++;
mRadio->prepareDevInformCmd(iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmMesIndex, false);
mRadio->prepareDevInformCmd(iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmLastId, false);
mPayload[iv->id].txCmd = cmd;
}

Expand Down
4 changes: 2 additions & 2 deletions src/hm/hmRadio.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ class HmRadio {
mTxBuf[10] = cmd; // cid
mTxBuf[11] = 0x00;
CP_U32_LittleEndian(&mTxBuf[12], ts);
/*if (cmd == AlarmData ) { //cmd == RealTimeRunData_Debug ||
if (cmd == AlarmData ) { //cmd == RealTimeRunData_Debug ||
mTxBuf[18] = (alarmMesId >> 8) & 0xff;
mTxBuf[19] = (alarmMesId ) & 0xff;
}*/
}
sendPacket(invId, 24, isRetransmit);
}

Expand Down
6 changes: 3 additions & 3 deletions src/hms/hmsPayload.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class HmsPayload {
DPRINT_IVID(DBG_INFO, iv->id);
DBGPRINT(F("prepareDevInformCmd 0x"));
DBGHEXLN(cmd);
mRadio->prepareDevInformCmd(&iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmMesIndex, false);
mRadio->prepareDevInformCmd(&iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmLastId, false);
mPayload[iv->id].txCmd = cmd;
}
}
Expand Down Expand Up @@ -238,7 +238,7 @@ class HmsPayload {
//DPRINTLN(DBG_WARN, F("nothing received: Request Complete Retransmit"));
//mPayload[iv->id].txCmd = iv->getQueuedCmd();
//DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") prepareDevInformCmd 0x") + String(mPayload[iv->id].txCmd, HEX));
//mRadio->prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex, true);
//mRadio->prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmLastId, true);

DPRINT_IVID(DBG_INFO, iv->id);
DBGPRINTLN(F("nothing received"));
Expand Down Expand Up @@ -267,7 +267,7 @@ class HmsPayload {
DBGPRINT(String(iv->id));
DBGPRINT(F(") prepareDevInformCmd 0x"));
DBGPRINTLN(String(mPayload[iv->id].txCmd, HEX));
mRadio->prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex, true);
mRadio->prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmLastId, true);
}
}*/ else { // payload complete
DPRINT(DBG_INFO, F("procPyld: cmd: 0x"));
Expand Down
4 changes: 2 additions & 2 deletions src/hms/hmsRadio.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ class CmtRadio {
initPacket(ivId, reqfld, ALL_FRAMES);
mTxBuf[10] = cmd;
CP_U32_LittleEndian(&mTxBuf[12], ts);
/*if (cmd == AlarmData ) { //cmd == RealTimeRunData_Debug ||
if (cmd == AlarmData ) { //cmd == RealTimeRunData_Debug ||
mTxBuf[18] = (alarmMesId >> 8) & 0xff;
mTxBuf[19] = (alarmMesId ) & 0xff;
}*/
}
sendPacket(24, isRetransmit);
}

Expand Down

0 comments on commit cefcc9c

Please sign in to comment.