eive-tmtc/pus_tm/system/core.py

22 lines
751 B
Python
Raw Normal View History

2022-05-19 13:20:22 +02:00
import struct
from pus_tm.defs import PrintWrapper
from pus_tc.system.core import SetIds
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
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)