Add SUPV latchup report handling, clean up code #273

Merged
meggert merged 7 commits from add-supv-latchup-report into main 2024-02-06 13:52:56 +01:00
Showing only changes of commit 248df1d4df - Show all commits

View File

@ -861,8 +861,8 @@ def handle_counters_report(hk_data: bytes):
def handle_latchup_status_report(hk_data: bytes):
# 1 byte ID, 7 times 2 bytes of counts, and 8 bytes of time.
if len(hk_data) < 23:
# 1 byte ID, 7 times 2 bytes of counts, and 8 bytes of time and 1 byte sync status.
if len(hk_data) < 24:
raise ValueError("Latchup status report smaller than expected")
current_idx = 0
id = hk_data[current_idx]
@ -889,6 +889,9 @@ def handle_latchup_status_report(hk_data: bytes):
current_idx += 1
# Is stored as years since 1900.
time_year = 1900 + hk_data[current_idx]
current_idx += 1
is_synced = hk_data[current_idx]
print(f"Time Sync Status: {is_synced}")
try:
dt = datetime(
year=time_year,