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-19 14:50:24 +02:00
|
|
|
TM_TCP_SERVER = TmTcpServer.getInstance()
|
|
|
|
|
|
|
|
|
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
|
|
|
|
tm_data = struct.unpack("!ffffffffffffffff", hk_data[: 16 * 4])
|
2022-05-22 22:02:44 +02:00
|
|
|
parsed_data = {}
|
|
|
|
|
|
|
|
# put them into an nice dictionary
|
|
|
|
parsed_data["SENSOR_PLOC_HEATSPREADER"] = tm_data[0]
|
|
|
|
parsed_data["SENSOR_PLOC_MISSIONBOARD"] = tm_data[1]
|
|
|
|
parsed_data["SENSOR_4K_CAMERA"] = tm_data[2]
|
|
|
|
parsed_data["SENSOR_DAC_HEATSPREADER"] = tm_data[3]
|
|
|
|
parsed_data["SENSOR_STARTRACKER"] = tm_data[4]
|
|
|
|
parsed_data["SENSOR_RW1"] = tm_data[5]
|
|
|
|
parsed_data["SENSOR_DRO"] = tm_data[6]
|
|
|
|
parsed_data["SENSOR_SCEX"] = tm_data[7]
|
|
|
|
parsed_data["SENSOR_X8"] = tm_data[8]
|
|
|
|
parsed_data["SENSOR_HPA"] = tm_data[9]
|
|
|
|
parsed_data["SENSOR_TX_MODUL"] = tm_data[10]
|
|
|
|
parsed_data["SENSOR_MPA"] = tm_data[11]
|
|
|
|
parsed_data["SENSOR_ACU"] = tm_data[12]
|
|
|
|
parsed_data["SENSOR_PLPCDU_HEATSPREADER"] = tm_data[13]
|
|
|
|
parsed_data["SENSOR_TCS_BOARD"] = tm_data[14]
|
|
|
|
parsed_data["SENSOR_MAGNETTORQUER"] = tm_data[15]
|
2022-05-19 13:20:22 +02:00
|
|
|
|
|
|
|
TM_TCP_SERVER.report_parsed_hk_data(object_id, set_id, parsed_data)
|