Browse Source

0.7.56

* only request alarms which were not received before #1113
* added flag if alarm was requested but not received and re-request it #1105
pull/1169/head
lumapu 1 year ago
parent
commit
cefcc9c8c3
  1. 4
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 10
      src/hm/hmInverter.h
  4. 8
      src/hm/hmPayload.h
  5. 4
      src/hm/hmRadio.h
  6. 6
      src/hms/hmsPayload.h
  7. 4
      src/hms/hmsRadio.h

4
src/CHANGES.md

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

2
src/defines.h

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

10
src/hm/hmInverter.h

@ -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
@ -173,6 +174,7 @@ class Inverter {
status = InverterStatus::OFF;
alarmNxtWrPos = 0;
alarmCnt = 0;
alarmLastId = 0;
rssi = -127;
}
@ -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) {
@ -338,6 +342,7 @@ class Inverter {
DPRINT(DBG_INFO, "alarm ID incremented to ");
DBGPRINTLN(String(alarmMesIndex));
alarmReqPending = true;
enqueCommand<InfoCommand>(AlarmData);
}
}
@ -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) {
@ -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];
}

8
src/hm/hmPayload.h

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

4
src/hm/hmRadio.h

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

6
src/hms/hmsPayload.h

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

4
src/hms/hmsRadio.h

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

Loading…
Cancel
Save