Skip to content

Commit

Permalink
0.8.128
Browse files Browse the repository at this point in the history
* add environments for 16MB flash size ESP32-S3 aka opendtufusion
* prevent duplicate alarms, update end time once it is received
  • Loading branch information
lumapu committed Jul 10, 2024
1 parent 82e4d84 commit dcb4b49
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Development Changes

## 0.8.128 - 2024-07-02
## 0.8.128 - 2024-07-10
* add environments for 16MB flash size ESP32-S3 aka opendtufusion
* prevent duplicate alarms, update end time once it is received

## 0.8.127 - 2024-06-21
* add grid file #1677
Expand Down
21 changes: 20 additions & 1 deletion src/hm/hmInverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ 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);

alarmCnt++;
alarmLastId = alarmMesIndex;

return pyld[startOff+1];
Expand Down Expand Up @@ -818,6 +817,26 @@ class Inverter {

private:
inline void addAlarm(uint16_t code, uint32_t start, uint32_t end) {
bool found = false;
uint8_t i = 0;

if(start > end)
end = 0;

for(; i < 10; i++) {
mAlarmNxtWrPos = (++mAlarmNxtWrPos) % 10;

if(lastAlarm[mAlarmNxtWrPos].code == code && lastAlarm[mAlarmNxtWrPos].start == start) {
// replace with same or update end time
if(lastAlarm[mAlarmNxtWrPos].end == 0 || lastAlarm[mAlarmNxtWrPos].end == end) {
break;
}
}
}

if(alarmCnt < 10 && alarmCnt < mAlarmNxtWrPos)
alarmCnt = mAlarmNxtWrPos + 1;

lastAlarm[mAlarmNxtWrPos] = alarm_t(code, start, end);
if(++mAlarmNxtWrPos >= 10) // rolling buffer
mAlarmNxtWrPos = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/web/html/visualization.html
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
ml("div", {class: "col mt-3"}, String(a.str)),
ml("div", {class: "col mt-3"}, String(a.code)),
ml("div", {class: "col mt-3"}, String(toIsoTimeStr(new Date((a.start + offs) * 1000)))),
ml("div", {class: "col mt-3"}, String(toIsoTimeStr(new Date((a.end + offs) * 1000))))
ml("div", {class: "col mt-3"}, (a.end == 0) ? "-" : String(toIsoTimeStr(new Date((a.end + offs) * 1000))))
])
);
}
Expand Down

0 comments on commit dcb4b49

Please sign in to comment.