mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-27 15:56:11 +02:00
0.8.128
* add environments for 16MB flash size ESP32-S3 aka opendtufusion * prevent duplicate alarms, update end time once it is received
This commit is contained in:
parent
82e4d84522
commit
dcb4b49fa0
3 changed files with 23 additions and 3 deletions
|
@ -1,7 +1,8 @@
|
||||||
# Development Changes
|
# Development Changes
|
||||||
|
|
||||||
## 0.8.128 - 2024-07-02
|
## 0.8.128 - 2024-07-10
|
||||||
* add environments for 16MB flash size ESP32-S3 aka opendtufusion
|
* 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
|
## 0.8.127 - 2024-06-21
|
||||||
* add grid file #1677
|
* add grid file #1677
|
||||||
|
|
|
@ -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));
|
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);
|
||||||
|
|
||||||
alarmCnt++;
|
|
||||||
alarmLastId = alarmMesIndex;
|
alarmLastId = alarmMesIndex;
|
||||||
|
|
||||||
return pyld[startOff+1];
|
return pyld[startOff+1];
|
||||||
|
@ -818,6 +817,26 @@ class Inverter {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void addAlarm(uint16_t code, uint32_t start, uint32_t end) {
|
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);
|
lastAlarm[mAlarmNxtWrPos] = alarm_t(code, start, end);
|
||||||
if(++mAlarmNxtWrPos >= 10) // rolling buffer
|
if(++mAlarmNxtWrPos >= 10) // rolling buffer
|
||||||
mAlarmNxtWrPos = 0;
|
mAlarmNxtWrPos = 0;
|
||||||
|
|
|
@ -276,7 +276,7 @@
|
||||||
ml("div", {class: "col mt-3"}, String(a.str)),
|
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(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.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))))
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue