eive-tmtc/pus_tm/system/tcs.py

40 lines
1.4 KiB
Python
Raw Normal View History

2022-05-19 13:20:22 +02:00
import struct
from pus_tm.defs import PrintWrapper
from pus_tm.hk_handling import TM_TCP_SERVER
from tmtccmd.utility import ObjectId
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
def handle_thermal_controller_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
):
if set_id == 0:
pw = PrintWrapper(printer)
pw.dlog("Received Sensor Temperature data")
# get all the floats
tm_data = struct.unpack("!ffffffffffffffff", hk_data[: 16 * 4])
# put them into an list with their names
parsed_data = [
{"SENSOR_PLOC_HEATSPREADER": tm_data[0]},
{"SENSOR_PLOC_MISSIONBOARD": tm_data[1]},
{"SENSOR_4K_CAMERA": tm_data[2]},
{"SENSOR_DAC_HEATSPREADER": tm_data[3]},
{"SENSOR_STARTRACKER": tm_data[4]},
{"SENSOR_RW1": tm_data[5]},
{"SENSOR_DRO": tm_data[6]},
{"SENSOR_SCEX": tm_data[7]},
{"SENSOR_X8": tm_data[8]},
{"SENSOR_HPA": tm_data[9]},
{"SENSOR_TX_MODUL": tm_data[10]},
{"SENSOR_MPA": tm_data[11]},
{"SENSOR_ACU": tm_data[12]},
{"SENSOR_PLPCDU_HEATSPREADER": tm_data[13]},
{"SENSOR_TCS_BOARD": tm_data[14]},
{"SENSOR_MAGNETTORQUER": tm_data[15]},
]
TM_TCP_SERVER.report_parsed_hk_data(object_id, set_id, parsed_data)