Improvements for TVAC tests #98

Merged
muellerr merged 25 commits from meier/tvac-tests into develop 2022-06-15 11:31:00 +02:00
2 changed files with 15 additions and 27 deletions
Showing only changes of commit a1cbc3bc13 - Show all commits

View File

@ -6,7 +6,7 @@ from tmtccmd.utility import ObjectId
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
TM_TCP_SERVER = TmTcpServer.getInstance()
TM_TCP_SERVER = TmTcpServer.get_instance()
def handle_thermal_controller_hk_data(
@ -17,27 +17,15 @@ def handle_thermal_controller_hk_data(
pw.dlog("Received Sensor Temperature data")
# get all the floats
tm_data = struct.unpack("!ffffffffffffffff", hk_data[: 18 * 4])
parsed_data = {}
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]}
# put them into a 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]
parsed_data["TMP1075 1"] = tm_data[16]
parsed_data["TMP1075 2"] = tm_data[17]
print(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:
_Instance = None
def __init__(self):
@ -41,17 +40,18 @@ class TmTcpServer:
def close(self):
self.server_socket.close()
if self.client_connection != None:
if self.client_connection is not None:
self.client_connection.close()
def getInstance():
if TmTcpServer._Instance == None:
@staticmethod
def get_instance():
if TmTcpServer._Instance is None:
TmTcpServer._Instance = TmTcpServer()
return TmTcpServer._Instance
def _send_dictionary_over_socket(self, dictionary):
# keep listeners current
if self.client_connection == None:
if self.client_connection is None:
# no running connection, see if a client wants to connect
try:
(self.client_connection, _) = self.server_socket.accept()