add latchup status report handling
All checks were successful
EIVE/-/pipeline/head This commit looks good
All checks were successful
EIVE/-/pipeline/head This commit looks good
This commit is contained in:
parent
d33013ed58
commit
d69d16c3af
@ -6,6 +6,7 @@
|
|||||||
@author J. Meier
|
@author J. Meier
|
||||||
@date 10.07.2021
|
@date 10.07.2021
|
||||||
"""
|
"""
|
||||||
|
from datetime import datetime
|
||||||
import enum
|
import enum
|
||||||
import logging
|
import logging
|
||||||
import struct
|
import struct
|
||||||
@ -42,14 +43,14 @@ MANUAL_INPUT = "1"
|
|||||||
HARDCODED_FILE = "/home/rmueller/EIVE/mpsoc_boot.bin"
|
HARDCODED_FILE = "/home/rmueller/EIVE/mpsoc_boot.bin"
|
||||||
|
|
||||||
UPDATE_FILE_DICT = {
|
UPDATE_FILE_DICT = {
|
||||||
HARDCODED: ["hardcoded", ""],
|
HARDCODED: ("hardcoded", ""),
|
||||||
MANUAL_INPUT: ["manual input", ""],
|
MANUAL_INPUT: ("manual input", ""),
|
||||||
"2": ["/mnt/sd0/ploc/mpsoc/image.bin", "/mnt/sd0/ploc/mpsoc/image.bin"],
|
"2": ("/mnt/sd0/ploc/mpsoc/image.bin", "/mnt/sd0/ploc/mpsoc/image.bin"),
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_BUFFER_PATH_DICT = {
|
EVENT_BUFFER_PATH_DICT = {
|
||||||
MANUAL_INPUT: ["manual input", ""],
|
MANUAL_INPUT: ("manual input", ""),
|
||||||
"2": ["/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"],
|
"2": ("/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +150,6 @@ class OpCode:
|
|||||||
|
|
||||||
|
|
||||||
class Info(str, enum.Enum):
|
class Info(str, enum.Enum):
|
||||||
value: str
|
|
||||||
OFF = "Switch Off"
|
OFF = "Switch Off"
|
||||||
ON = "Switch On"
|
ON = "Switch On"
|
||||||
NML = "Switch Normal"
|
NML = "Switch Normal"
|
||||||
@ -766,6 +766,8 @@ def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
|
|||||||
handle_adc_report(hk_data)
|
handle_adc_report(hk_data)
|
||||||
elif set_id == SetId.COUNTERS_REPORT:
|
elif set_id == SetId.COUNTERS_REPORT:
|
||||||
handle_counters_report(hk_data)
|
handle_counters_report(hk_data)
|
||||||
|
elif set_id == SetId.LATCHUP_REPORT:
|
||||||
|
handle_latchup_status_report(hk_data)
|
||||||
else:
|
else:
|
||||||
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
|
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
|
||||||
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
|
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
|
||||||
@ -907,3 +909,43 @@ def handle_counters_report(hk_data: bytes):
|
|||||||
print(f"MM task lost: {mm_task_lost}")
|
print(f"MM task lost: {mm_task_lost}")
|
||||||
print(f"HK task lost: {hk_task_lost}")
|
print(f"HK task lost: {hk_task_lost}")
|
||||||
print(f"DL task lost: {dl_task_lost}")
|
print(f"DL task lost: {dl_task_lost}")
|
||||||
|
|
||||||
|
|
||||||
|
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:
|
||||||
|
raise ValueError("Latchup status report smaller than expected")
|
||||||
|
current_idx = 0
|
||||||
|
id = hk_data[current_idx]
|
||||||
|
current_idx += 1
|
||||||
|
counts_of_alerts = []
|
||||||
|
for _ in range(7):
|
||||||
|
counts_of_alerts.append(
|
||||||
|
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||||
|
)
|
||||||
|
current_idx += 2
|
||||||
|
print(f"ID: {id}")
|
||||||
|
print(f"Counts of alerts: {counts_of_alerts}")
|
||||||
|
time_ms = struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||||
|
current_idx += 2
|
||||||
|
time_seconds = hk_data[current_idx]
|
||||||
|
current_idx += 1
|
||||||
|
time_minutes = hk_data[current_idx]
|
||||||
|
current_idx += 1
|
||||||
|
time_hour = hk_data[current_idx]
|
||||||
|
current_idx += 1
|
||||||
|
time_day = hk_data[current_idx]
|
||||||
|
current_idx += 1
|
||||||
|
time_month = hk_data[current_idx]
|
||||||
|
current_idx += 1
|
||||||
|
time_year = hk_data[current_idx]
|
||||||
|
dt = datetime(
|
||||||
|
year=time_year,
|
||||||
|
month=time_month,
|
||||||
|
day=time_day,
|
||||||
|
hour=time_hour,
|
||||||
|
minute=time_minutes,
|
||||||
|
second=time_seconds,
|
||||||
|
microsecond=time_ms * 1000,
|
||||||
|
)
|
||||||
|
print(f"Time Now: {dt}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user