Update AlarmLogParser
* Show times > 12:00:00 * Fixed parsing of StartTime
This commit is contained in:
parent
ca1b27b317
commit
0fed0ba614
@ -28,12 +28,23 @@ void AlarmLogParser::getLogEntry(uint8_t entryId, AlarmLogEntry_t* entry)
|
|||||||
|
|
||||||
int timezoneOffset = getTimezoneOffset();
|
int timezoneOffset = getTimezoneOffset();
|
||||||
|
|
||||||
|
uint32_t wcode = (uint16_t)_payloadAlarmLog[entryStartOffset] << 8 | _payloadAlarmLog[entryStartOffset + 1];
|
||||||
|
uint32_t startTimeOffset = 0;
|
||||||
|
if ((wcode >> 13) & 0x01 == 1) {
|
||||||
|
startTimeOffset = 12 * 60 * 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t endTimeOffset = 0;
|
||||||
|
if ((wcode >> 12) & 0x01 == 1) {
|
||||||
|
endTimeOffset = 12 * 60 * 60;
|
||||||
|
}
|
||||||
|
|
||||||
entry->MessageId = _payloadAlarmLog[entryStartOffset + 1];
|
entry->MessageId = _payloadAlarmLog[entryStartOffset + 1];
|
||||||
entry->StartTime = ((uint16_t)_payloadAlarmLog[entryStartOffset + 4] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 5]) + timezoneOffset;
|
entry->StartTime = (((uint16_t)_payloadAlarmLog[entryStartOffset + 4] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 5])) + startTimeOffset + timezoneOffset;
|
||||||
entry->EndTime = ((uint16_t)_payloadAlarmLog[entryStartOffset + 6] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 7]);
|
entry->EndTime = ((uint16_t)_payloadAlarmLog[entryStartOffset + 6] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 7]);
|
||||||
|
|
||||||
if (entry->EndTime > 0) {
|
if (entry->EndTime > 0) {
|
||||||
entry->EndTime += timezoneOffset;
|
entry->EndTime += (endTimeOffset + timezoneOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (entry->MessageId) {
|
switch (entry->MessageId) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user