diff --git a/eive_tmtc/config/definitions.py b/eive_tmtc/config/definitions.py index a80444c..a46b708 100644 --- a/eive_tmtc/config/definitions.py +++ b/eive_tmtc/config/definitions.py @@ -70,7 +70,7 @@ class CustomServiceList(str, enum.Enum): TIME = "time" PROCEDURE = "proc" RTD = "rtd" - TMP1075 = "tcs_tmp" + TMP1075 = "tmp1075" TVTTESTPROCEDURE = "tvtestproc" SCEX = "scex" TM_STORE = "tm_store" diff --git a/eive_tmtc/pus_tm/hk_handling.py b/eive_tmtc/pus_tm/hk_handling.py index 1eb3c47..4011705 100644 --- a/eive_tmtc/pus_tm/hk_handling.py +++ b/eive_tmtc/pus_tm/hk_handling.py @@ -13,6 +13,7 @@ from eive_tmtc.tmtc.payload.ploc_supervisor import handle_supv_hk_data from eive_tmtc.tmtc.acs.reaction_wheels import handle_rw_hk_data from eive_tmtc.tmtc.com.syrlinks_handler import handle_syrlinks_hk_data from eive_tmtc.tmtc.tcs import handle_thermal_controller_hk_data +from eive_tmtc.tmtc.tcs.tmp1075 import handle_tmp_1075_hk_data from spacepackets.ecss import PusTelemetry from tmtccmd.tm.pus_3_fsfw_hk import ( Service3Base, @@ -171,6 +172,13 @@ def handle_regular_hk_print( # noqa C901: Complexity okay here return handle_str_hk_data(set_id=set_id, hk_data=hk_data, pw=pw) elif objb == obj_ids.PLOC_SUPV_ID: return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, pw=pw) + elif objb in [ + obj_ids.TMP1075_HANDLER_TCS_BRD_0_ID, + obj_ids.TMP1075_HANDLER_TCS_BRD_1_ID, + obj_ids.TMP1075_HANDLER_IF_BRD_ID, + obj_ids.TMP1075_HANDLER_PLPCDU_0_ID, + ]: + return handle_tmp_1075_hk_data(set_id=set_id, hk_data=hk_data, pw=pw) elif objb == obj_ids.ACS_CONTROLLER: return handle_acs_ctrl_hk_data( pw=pw, set_id=set_id, hk_data=hk_data, packet_time=packet_dt diff --git a/eive_tmtc/tmtc/__init__.py b/eive_tmtc/tmtc/__init__.py index 584b178..93a44f6 100644 --- a/eive_tmtc/tmtc/__init__.py +++ b/eive_tmtc/tmtc/__init__.py @@ -5,3 +5,4 @@ from .time import add_time_cmds from .health import add_health_cmd_defs from .system import add_system_cmd_defs from .tm_store import add_persistent_tm_store_cmd_defs +from .tcs import add_tmp_sens_cmds diff --git a/eive_tmtc/tmtc/tcs/__init__.py b/eive_tmtc/tmtc/tcs/__init__.py index 51c7de7..e899aed 100644 --- a/eive_tmtc/tmtc/tcs/__init__.py +++ b/eive_tmtc/tmtc/tcs/__init__.py @@ -1 +1,2 @@ from .tm import * # noqa +from .tmp1075 import add_tmp_sens_cmds diff --git a/eive_tmtc/tmtc/tcs/tmp1075.py b/eive_tmtc/tmtc/tcs/tmp1075.py index 96173a2..a03554d 100644 --- a/eive_tmtc/tmtc/tcs/tmp1075.py +++ b/eive_tmtc/tmtc/tcs/tmp1075.py @@ -6,14 +6,17 @@ @date 06.01.2021 """ import enum +import struct from eive_tmtc.config.definitions import CustomServiceList +from eive_tmtc.pus_tm.defs import PrintWrapper from spacepackets.ecss.tc import PusTelecommand from tmtccmd.config.tmtc import ( tmtc_definitions_provider, TmtcDefinitionWrapper, OpCodeEntry, ) +from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data from tmtccmd.tc.pus_3_fsfw_hk import create_request_one_hk_command, make_sid @@ -76,3 +79,10 @@ def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCode.NML, Info.NML) oce.add(OpCode.HK, Info.HK) defs.add_service(CustomServiceList.TMP1075.value, "TMP1075 Temperature Sensor", oce) + + +def handle_tmp_1075_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper): + if set_id == SetId.TEMPERATURE: + temp = struct.unpack("!f", hk_data[0:4])[0] + pw.dlog(f"TMP1075 Temperature: {temp}") + pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[4:], 1))