42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
import struct
|
|
|
|
from pus_tm.defs import PrintWrapper
|
|
from pus_tm.tm_tcp_server import TmTcpServer
|
|
from tmtccmd.utility import ObjectId
|
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
|
|
|
|
|
TM_TCP_SERVER = TmTcpServer.getInstance()
|
|
|
|
|
|
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])
|
|
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]
|
|
|
|
TM_TCP_SERVER.report_parsed_hk_data(object_id, set_id, parsed_data)
|