2023-06-28 10:43:11 +02:00
|
|
|
import enum
|
|
|
|
import struct
|
|
|
|
|
|
|
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
2024-05-08 10:49:20 +02:00
|
|
|
from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str
|
2023-06-28 10:43:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SetId(enum.IntEnum):
|
|
|
|
ERROR_ID = 0
|
|
|
|
|
|
|
|
|
|
|
|
def handle_ier_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int):
|
|
|
|
pw.dlog(f"Received internal error reporter HK data with set ID {set_id}")
|
|
|
|
if set_id == SetId.ERROR_ID:
|
|
|
|
fmt_str = "!III"
|
|
|
|
inc_len = struct.calcsize(fmt_str)
|
|
|
|
(tm_errors, queue_errors, store_hits) = struct.unpack(
|
|
|
|
fmt_str, hk_data[:inc_len]
|
|
|
|
)
|
|
|
|
pw.dlog(f"TM Errors: {tm_errors}")
|
|
|
|
pw.dlog(f"Queue Errors: {queue_errors}")
|
|
|
|
pw.dlog(f"Store Errors: {store_hits}")
|
2024-05-08 10:49:20 +02:00
|
|
|
pw.dlog(get_validity_buffer_str(hk_data[inc_len:], 3))
|