clean up TCS server printout

This commit is contained in:
Robin Müller 2022-09-29 17:41:37 +02:00
parent 52d91fe857
commit c8eaf180dc
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 27 additions and 21 deletions

View File

@ -1,5 +1,5 @@
"""HK Handling for EIVE OBSW""" """HK Handling for EIVE OBSW"""
from pus_tm.tcp_server_objects import tcp_server_sensor_temperatures # from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
from tmtc.acs_ctrl import handle_acs_ctrl_mgm_data from tmtc.acs_ctrl import handle_acs_ctrl_mgm_data
from pus_tm.devs.plpcdu import handle_plpcdu_hk from pus_tm.devs.plpcdu import handle_plpcdu_hk
from pus_tm.devs.rad_sensor import handle_rad_sensor_data from pus_tm.devs.rad_sensor import handle_rad_sensor_data
@ -51,9 +51,11 @@ def handle_hk_packet(
if tm_packet.subservice == 25 or tm_packet.subservice == 26: if tm_packet.subservice == 25 or tm_packet.subservice == 26:
hk_data = tm_packet.tm_data[8:] hk_data = tm_packet.tm_data[8:]
if FORWARD_SENSOR_TEMPS: if FORWARD_SENSOR_TEMPS:
tcp_server_sensor_temperatures.report_raw_hk_data( # TODO: Maybe use singleton?
object_id=named_obj_id, set_id=tm_packet.set_id, hk_data=hk_data # TCP_SEVER_SENSOR_TEMPERATURES.report_raw_hk_data(
) # object_id=named_obj_id, set_id=tm_packet.set_id, hk_data=hk_data
# )
pass
printer.generic_hk_tm_print( printer.generic_hk_tm_print(
content_type=HkContentType.HK, content_type=HkContentType.HK,
object_id=named_obj_id, object_id=named_obj_id,

View File

@ -1,12 +1,8 @@
import enum import enum
import pprint
import struct import struct
from pus_tm.defs import PrintWrapper from pus_tm.defs import PrintWrapper
from pus_tm.tcp_server_objects import (
tcp_server_sensor_temperatures,
tcp_server_device_temperatures,
)
from pus_tm.tm_tcp_server import TmTcpServer
from tmtccmd.util import ObjectIdU32 from tmtccmd.util import ObjectIdU32
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
@ -20,10 +16,13 @@ class SetIds(enum.IntEnum):
def handle_thermal_controller_hk_data( def handle_thermal_controller_hk_data(
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if tcp_server_sensor_temperatures is None: # need a better solutuon for this is this is used again..
tcp_server_sensor_temperatures = TmTcpServer("localhost", 7305) """
if tcp_server_device_temperatures is None: if TCP_TEMP_SENS_SERVER is None:
tcp_server_device_temperatures = TmTcpServer("localhost", 7306) TCP_TEMP_SENS_SERVER = TmTcpServer("localhost", 7305)
if TCP_TEMP_DEV_SERVER:
TCP_TEMP_DEV_SERVER = TmTcpServer("localhost", 7306)
"""
if set_id == SetIds.SENSOR_TEMPERATURE_SET: if set_id == SetIds.SENSOR_TEMPERATURE_SET:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
pw.dlog("Received sensor temperature data") pw.dlog("Received sensor temperature data")
@ -51,9 +50,11 @@ def handle_thermal_controller_hk_data(
"TMP1075 2": tm_data[17], "TMP1075 2": tm_data[17],
} }
printer.file_logger.info(str(parsed_data)) printer.file_logger.info(str(parsed_data))
tcp_server_sensor_temperatures.report_parsed_hk_data( pp = pprint.PrettyPrinter(depth=4)
object_id, set_id, parsed_data pp.pprint(parsed_data)
) # tcp_server_sensor_temperatures.report_parsed_hk_data(
# object_id, set_id, parsed_data
# )
elif set_id == SetIds.DEVICE_TEMPERATURE_SET: elif set_id == SetIds.DEVICE_TEMPERATURE_SET:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
pw.dlog("Received device temperature data") pw.dlog("Received device temperature data")
@ -88,10 +89,13 @@ def handle_thermal_controller_hk_data(
"MGM_1_TEMPERATURE": tm_data[25], "MGM_1_TEMPERATURE": tm_data[25],
"ADC_PL_PCDU_TEMPERATURE": tm_data[26], "ADC_PL_PCDU_TEMPERATURE": tm_data[26],
} }
printer.file_logger.info(str(parsed_data))
pp = pprint.PrettyPrinter(depth=4)
pp.pprint(parsed_data)
# print(parsed_data) # print(parsed_data)
tcp_server_device_temperatures.report_parsed_hk_data( # tcp_server_device_temperatures.report_parsed_hk_data(
object_id, set_id, parsed_data # object_id, set_id, parsed_data
) # )
elif set_id == SetIds.SUS_TEMPERATURE_SET: elif set_id == SetIds.SUS_TEMPERATURE_SET:
pass pass
# pw = PrintWrapper(printer) # pw = PrintWrapper(printer)

View File

@ -2,5 +2,5 @@ from typing import Optional
from pus_tm.tm_tcp_server import TmTcpServer from pus_tm.tm_tcp_server import TmTcpServer
tcp_server_sensor_temperatures: Optional[TmTcpServer] = None TCP_SERVER_SENSOR_TEMPERATURES: Optional[TmTcpServer] = None
tcp_server_device_temperatures: Optional[TmTcpServer] = None TCP_SERVER_DEVICE_TEMPERATURES: Optional[TmTcpServer] = None