mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-10 21:17:17 +02:00
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
This commit is contained in:
parent
882e96b93b
commit
cefcc9c8c3
7 changed files with 25 additions and 13 deletions
|
@ -1,5 +1,9 @@
|
||||||
# Development Changes
|
# 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
|
## 0.7.55 - 2023-09-17
|
||||||
* fix prometheus builds
|
* fix prometheus builds
|
||||||
* fix ESP32 default pinout #1159
|
* fix ESP32 default pinout #1159
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 7
|
#define VERSION_MINOR 7
|
||||||
#define VERSION_PATCH 55
|
#define VERSION_PATCH 56
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -145,13 +145,14 @@ class Inverter {
|
||||||
record_t<REC_TYP> recordHwInfo; // structure for simple (hardware) info values
|
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> recordConfig; // structure for system config values
|
||||||
record_t<REC_TYP> recordAlarm; // structure for alarm 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 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)
|
bool isConnected; // shows if inverter was successfully identified (fw version and hardware info)
|
||||||
InverterStatus status; // indicates the current inverter status
|
InverterStatus status; // indicates the current inverter status
|
||||||
std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms
|
std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms
|
||||||
uint8_t alarmNxtWrPos; // indicates the position in array (rolling buffer)
|
uint8_t alarmNxtWrPos; // indicates the position in array (rolling buffer)
|
||||||
uint16_t alarmCnt; // counts the total number of occurred alarms
|
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
|
int8_t rssi; // HMS and HMT inverters only
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,6 +174,7 @@ class Inverter {
|
||||||
status = InverterStatus::OFF;
|
status = InverterStatus::OFF;
|
||||||
alarmNxtWrPos = 0;
|
alarmNxtWrPos = 0;
|
||||||
alarmCnt = 0;
|
alarmCnt = 0;
|
||||||
|
alarmLastId = 0;
|
||||||
rssi = -127;
|
rssi = -127;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +210,8 @@ class Inverter {
|
||||||
enqueCommand<InfoCommand>(InverterDevInform_All); // firmware version
|
enqueCommand<InfoCommand>(InverterDevInform_All); // firmware version
|
||||||
else if (getHwVersion() == 0)
|
else if (getHwVersion() == 0)
|
||||||
enqueCommand<InfoCommand>(InverterDevInform_Simple); // hardware version
|
enqueCommand<InfoCommand>(InverterDevInform_Simple); // hardware version
|
||||||
|
else if(alarmReqPending)
|
||||||
|
enqueCommand<InfoCommand>(AlarmData); // alarm not answered
|
||||||
enqueCommand<InfoCommand>(RealTimeRunData_Debug); // live data
|
enqueCommand<InfoCommand>(RealTimeRunData_Debug); // live data
|
||||||
} else if (ivGen == IV_MI){
|
} else if (ivGen == IV_MI){
|
||||||
if (getFwVersion() == 0) {
|
if (getFwVersion() == 0) {
|
||||||
|
@ -338,6 +342,7 @@ class Inverter {
|
||||||
|
|
||||||
DPRINT(DBG_INFO, "alarm ID incremented to ");
|
DPRINT(DBG_INFO, "alarm ID incremented to ");
|
||||||
DBGPRINTLN(String(alarmMesIndex));
|
DBGPRINTLN(String(alarmMesIndex));
|
||||||
|
alarmReqPending = true;
|
||||||
enqueCommand<InfoCommand>(AlarmData);
|
enqueCommand<InfoCommand>(AlarmData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -598,6 +603,7 @@ class Inverter {
|
||||||
lastAlarm.fill({0, 0, 0});
|
lastAlarm.fill({0, 0, 0});
|
||||||
alarmNxtWrPos = 0;
|
alarmNxtWrPos = 0;
|
||||||
alarmCnt = 0;
|
alarmCnt = 0;
|
||||||
|
alarmLastId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t parseAlarmLog(uint8_t id, uint8_t pyld[], uint8_t len) {
|
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));
|
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);
|
addAlarm(pyld[startOff+1], start, endTime);
|
||||||
|
|
||||||
|
alarmReqPending = false;
|
||||||
alarmCnt++;
|
alarmCnt++;
|
||||||
|
alarmLastId = alarmMesIndex;
|
||||||
|
|
||||||
return pyld[startOff+1];
|
return pyld[startOff+1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ class HmPayload {
|
||||||
DPRINT_IVID(DBG_INFO, iv->id);
|
DPRINT_IVID(DBG_INFO, iv->id);
|
||||||
DBGPRINT(F("prepareDevInformCmd 0x"));
|
DBGPRINT(F("prepareDevInformCmd 0x"));
|
||||||
DBGHEXLN(cmd);
|
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;
|
mPayload[iv->id].txCmd = cmd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ class HmPayload {
|
||||||
DPRINTLN(DBG_WARN, F("nothing received: Request Complete Retransmit"));
|
DPRINTLN(DBG_WARN, F("nothing received: Request Complete Retransmit"));
|
||||||
mPayload[iv->id].txCmd = iv->getQueuedCmd();
|
mPayload[iv->id].txCmd = iv->getQueuedCmd();
|
||||||
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") prepareDevInformCmd 0x") + String(mPayload[iv->id].txCmd, HEX));
|
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);
|
DPRINT_IVID(DBG_INFO, iv->id);
|
||||||
DBGPRINTLN(F("nothing received"));
|
DBGPRINTLN(F("nothing received"));
|
||||||
|
@ -286,7 +286,7 @@ class HmPayload {
|
||||||
DBGPRINT(F("prepareDevInformCmd 0x"));
|
DBGPRINT(F("prepareDevInformCmd 0x"));
|
||||||
DBGHEXLN(mPayload[iv->id].txCmd);
|
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
|
} else { // payload complete
|
||||||
if (mSerialDebug) {
|
if (mSerialDebug) {
|
||||||
|
@ -364,7 +364,7 @@ class HmPayload {
|
||||||
DBGHEXLN(cmd);
|
DBGHEXLN(cmd);
|
||||||
}
|
}
|
||||||
mStat->rxSuccess++;
|
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;
|
mPayload[iv->id].txCmd = cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,10 +216,10 @@ class HmRadio {
|
||||||
mTxBuf[10] = cmd; // cid
|
mTxBuf[10] = cmd; // cid
|
||||||
mTxBuf[11] = 0x00;
|
mTxBuf[11] = 0x00;
|
||||||
CP_U32_LittleEndian(&mTxBuf[12], ts);
|
CP_U32_LittleEndian(&mTxBuf[12], ts);
|
||||||
/*if (cmd == AlarmData ) { //cmd == RealTimeRunData_Debug ||
|
if (cmd == AlarmData ) { //cmd == RealTimeRunData_Debug ||
|
||||||
mTxBuf[18] = (alarmMesId >> 8) & 0xff;
|
mTxBuf[18] = (alarmMesId >> 8) & 0xff;
|
||||||
mTxBuf[19] = (alarmMesId ) & 0xff;
|
mTxBuf[19] = (alarmMesId ) & 0xff;
|
||||||
}*/
|
}
|
||||||
sendPacket(invId, 24, isRetransmit);
|
sendPacket(invId, 24, isRetransmit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ class HmsPayload {
|
||||||
DPRINT_IVID(DBG_INFO, iv->id);
|
DPRINT_IVID(DBG_INFO, iv->id);
|
||||||
DBGPRINT(F("prepareDevInformCmd 0x"));
|
DBGPRINT(F("prepareDevInformCmd 0x"));
|
||||||
DBGHEXLN(cmd);
|
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;
|
mPayload[iv->id].txCmd = cmd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ class HmsPayload {
|
||||||
//DPRINTLN(DBG_WARN, F("nothing received: Request Complete Retransmit"));
|
//DPRINTLN(DBG_WARN, F("nothing received: Request Complete Retransmit"));
|
||||||
//mPayload[iv->id].txCmd = iv->getQueuedCmd();
|
//mPayload[iv->id].txCmd = iv->getQueuedCmd();
|
||||||
//DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") prepareDevInformCmd 0x") + String(mPayload[iv->id].txCmd, HEX));
|
//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);
|
DPRINT_IVID(DBG_INFO, iv->id);
|
||||||
DBGPRINTLN(F("nothing received"));
|
DBGPRINTLN(F("nothing received"));
|
||||||
|
@ -267,7 +267,7 @@ class HmsPayload {
|
||||||
DBGPRINT(String(iv->id));
|
DBGPRINT(String(iv->id));
|
||||||
DBGPRINT(F(") prepareDevInformCmd 0x"));
|
DBGPRINT(F(") prepareDevInformCmd 0x"));
|
||||||
DBGPRINTLN(String(mPayload[iv->id].txCmd, HEX));
|
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
|
}*/ else { // payload complete
|
||||||
DPRINT(DBG_INFO, F("procPyld: cmd: 0x"));
|
DPRINT(DBG_INFO, F("procPyld: cmd: 0x"));
|
||||||
|
|
|
@ -104,10 +104,10 @@ class CmtRadio {
|
||||||
initPacket(ivId, reqfld, ALL_FRAMES);
|
initPacket(ivId, reqfld, ALL_FRAMES);
|
||||||
mTxBuf[10] = cmd;
|
mTxBuf[10] = cmd;
|
||||||
CP_U32_LittleEndian(&mTxBuf[12], ts);
|
CP_U32_LittleEndian(&mTxBuf[12], ts);
|
||||||
/*if (cmd == AlarmData ) { //cmd == RealTimeRunData_Debug ||
|
if (cmd == AlarmData ) { //cmd == RealTimeRunData_Debug ||
|
||||||
mTxBuf[18] = (alarmMesId >> 8) & 0xff;
|
mTxBuf[18] = (alarmMesId >> 8) & 0xff;
|
||||||
mTxBuf[19] = (alarmMesId ) & 0xff;
|
mTxBuf[19] = (alarmMesId ) & 0xff;
|
||||||
}*/
|
}
|
||||||
sendPacket(24, isRetransmit);
|
sendPacket(24, isRetransmit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue