2022-05-19 13:20:22 +02:00
|
|
|
import struct
|
|
|
|
|
2022-11-29 16:53:29 +01:00
|
|
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
|
|
|
from eive_tmtc.pus_tc.system.core import SetIds
|
2022-07-08 16:25:46 +02:00
|
|
|
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
2022-05-19 13:20:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|
|
|
if set_id == SetIds.HK:
|
|
|
|
pw = PrintWrapper(printer)
|
|
|
|
fmt_str = "!fff"
|
|
|
|
inc_len = struct.calcsize(fmt_str)
|
|
|
|
(temperature, ps_voltage, pl_voltage) = struct.unpack(
|
|
|
|
fmt_str, hk_data[0 : 0 + inc_len]
|
|
|
|
)
|
|
|
|
printout = (
|
|
|
|
f"Chip Temperature [°C] {temperature} | PS Voltage [mV] {ps_voltage} | "
|
|
|
|
f"PL Voltage [mV] {pl_voltage}"
|
|
|
|
)
|
|
|
|
pw.dlog(printout)
|
2022-05-19 19:24:57 +02:00
|
|
|
printer.print_validity_buffer(validity_buffer=hk_data[inc_len:], num_vars=3)
|