25 lines
753 B
Python
25 lines
753 B
Python
|
import enum
|
||
|
import struct
|
||
|
|
||
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||
|
|
||
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||
|
|
||
|
|
||
|
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}")
|
||
|
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[inc_len:], 3))
|