2022-05-19 13:20:22 +02:00
|
|
|
import struct
|
|
|
|
|
|
|
|
from pus_tm.defs import PrintWrapper
|
2022-05-19 14:50:24 +02:00
|
|
|
from pus_tm.tm_tcp_server import TmTcpServer
|
2022-05-19 13:20:22 +02:00
|
|
|
from tmtccmd.utility import ObjectId
|
|
|
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
|
|
|
|
|
|
|
|
2022-05-31 11:44:08 +02:00
|
|
|
TM_TCP_SERVER = TmTcpServer.get_instance()
|
2022-05-19 14:50:24 +02:00
|
|
|
|
|
|
|
|
2022-05-19 13:20:22 +02:00
|
|
|
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
|
2022-05-31 11:44:08 +02:00
|
|
|
tm_data = struct.unpack("!ffffffffffffffffff", hk_data[: 18 * 4])
|
|
|
|
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], "TMP1075 1": tm_data[16], "TMP1075 2": tm_data[17]}
|
|
|
|
|
|
|
|
print(parsed_data)
|
2022-05-19 13:20:22 +02:00
|
|
|
|
|
|
|
TM_TCP_SERVER.report_parsed_hk_data(object_id, set_id, parsed_data)
|