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