debugging

This commit is contained in:
Jakob Meier 2022-05-31 11:44:08 +02:00
parent c3012cd7a4
commit a1cbc3bc13
2 changed files with 15 additions and 27 deletions

View File

@ -6,7 +6,7 @@ from tmtccmd.utility import ObjectId
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
TM_TCP_SERVER = TmTcpServer.getInstance() TM_TCP_SERVER = TmTcpServer.get_instance()
def handle_thermal_controller_hk_data( def handle_thermal_controller_hk_data(
@ -17,27 +17,15 @@ def handle_thermal_controller_hk_data(
pw.dlog("Received Sensor Temperature data") pw.dlog("Received Sensor Temperature data")
# get all the floats # get all the floats
tm_data = struct.unpack("!ffffffffffffffff", hk_data[: 18 * 4]) tm_data = struct.unpack("!ffffffffffffffffff", hk_data[: 18 * 4])
parsed_data = {} 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]}
# put them into a nice dictionary print(parsed_data)
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]
parsed_data["TMP1075 1"] = tm_data[16]
parsed_data["TMP1075 2"] = tm_data[17]
TM_TCP_SERVER.report_parsed_hk_data(object_id, set_id, parsed_data) TM_TCP_SERVER.report_parsed_hk_data(object_id, set_id, parsed_data)

View File

@ -15,7 +15,6 @@ LOGGER = get_console_logger()
class TmTcpServer: class TmTcpServer:
_Instance = None _Instance = None
def __init__(self): def __init__(self):
@ -41,17 +40,18 @@ class TmTcpServer:
def close(self): def close(self):
self.server_socket.close() self.server_socket.close()
if self.client_connection != None: if self.client_connection is not None:
self.client_connection.close() self.client_connection.close()
def getInstance(): @staticmethod
if TmTcpServer._Instance == None: def get_instance():
if TmTcpServer._Instance is None:
TmTcpServer._Instance = TmTcpServer() TmTcpServer._Instance = TmTcpServer()
return TmTcpServer._Instance return TmTcpServer._Instance
def _send_dictionary_over_socket(self, dictionary): def _send_dictionary_over_socket(self, dictionary):
# keep listeners current # keep listeners current
if self.client_connection == None: if self.client_connection is None:
# no running connection, see if a client wants to connect # no running connection, see if a client wants to connect
try: try:
(self.client_connection, _) = self.server_socket.accept() (self.client_connection, _) = self.server_socket.accept()