From b474841d69d045f2c1d9e179bbc92c83de51e708 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 14:27:00 +0100 Subject: [PATCH] add TMP1075 dev prompt --- CHANGELOG.md | 4 ++++ eive_tmtc/config/definitions.py | 1 + eive_tmtc/config/object_ids.py | 6 ++++-- eive_tmtc/pus_tc/procedure_packer.py | 26 ++++++++++++++++---------- eive_tmtc/utility/input_helper.py | 4 ++-- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c51c82f..c783a96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ list yields a list of all related PRs for each release. # [unreleased] +## Fixed + +- TMP1075 comands: Implement proper prompt for device select. + # [v2.10.0] 2023-02-03 tmtccmd v4.0.0rc0 diff --git a/eive_tmtc/config/definitions.py b/eive_tmtc/config/definitions.py index fb0abf0..6cb9764 100644 --- a/eive_tmtc/config/definitions.py +++ b/eive_tmtc/config/definitions.py @@ -71,6 +71,7 @@ class CustomServiceList(str, enum.Enum): TIME = "time" PROCEDURE = "proc" RTD = "rtd" + TMP1075 = "tcs_tmp" TVTTESTPROCEDURE = "tvtestproc" CONTROLLERS = "controllers" SCEX = "scex" diff --git a/eive_tmtc/config/object_ids.py b/eive_tmtc/config/object_ids.py index 2fca20a..6103522 100644 --- a/eive_tmtc/config/object_ids.py +++ b/eive_tmtc/config/object_ids.py @@ -30,8 +30,10 @@ SCEX_HANDLER_ID = bytes([0x44, 0x33, 0x00, 0x32]) # Thermal Object IDs THERMAL_CONTROLLER_ID = bytes([0x43, 0x40, 0x00, 0x01]) HEATER_CONTROLLER_ID = bytes([0x44, 0x41, 0x00, 0xA4]) -TMP_1075_1_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x04]) -TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05]) +TMP1075_HANDLER_TCS_BRD_0_ID = bytes([0x44, 0x42, 0x00, 0x04]) +TMP1075_HANDLER_TCS_BRD_1_ID = bytes([0x44, 0x42, 0x00, 0x05]) +TMP1075_HANDLER_PLPCDU_0_ID = bytes([0x44, 0x42, 0x00, 0x06]) +TMP1075_HANDLER_IF_BRD_ID = bytes([0x44, 0x42, 0x00, 0x08]) # Communication Object IDs SYRLINKS_HANDLER_ID = bytes([0x44, 0x53, 0x00, 0xA3]) diff --git a/eive_tmtc/pus_tc/procedure_packer.py b/eive_tmtc/pus_tc/procedure_packer.py index 795742c..1e42673 100644 --- a/eive_tmtc/pus_tc/procedure_packer.py +++ b/eive_tmtc/pus_tc/procedure_packer.py @@ -45,8 +45,10 @@ from eive_tmtc.config.object_ids import ( PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, - TMP_1075_1_HANDLER_ID, - TMP_1075_2_HANDLER_ID, + TMP1075_HANDLER_TCS_BRD_0_ID, + TMP1075_HANDLER_TCS_BRD_1_ID, + TMP1075_HANDLER_PLPCDU_0_ID, + TMP1075_HANDLER_IF_BRD_ID, HEATER_CONTROLLER_ID, IMTQ_HANDLER_ID, RW1_ID, @@ -74,6 +76,8 @@ from eive_tmtc.pus_tc.system.proc import pack_proc_commands import eive_tmtc.config.object_ids as oids from tmtccmd.util import ObjectIdU32 +from eive_tmtc.utility.input_helper import InputHelper + def handle_default_procedure( tc_base: TcHandlerBase, @@ -103,15 +107,17 @@ def handle_default_procedure( return pack_acu_commands(object_id=object_id, q=queue_helper, op_code=op_code) if service == CustomServiceList.TCS.value: return pack_tcs_sys_commands(q=queue_helper, op_code=op_code) - if service == CustomServiceList.TMP1075_1.value: - object_id = cast(ObjectIdU32, obj_id_man.get(TMP_1075_1_HANDLER_ID)) + if service == CustomServiceList.TMP1075.value: + menu_dict = { + "0": ("TMP1075 TCS Board 0", TMP1075_HANDLER_TCS_BRD_0_ID), + "1": ("TMP1075 TCS Board 1", TMP1075_HANDLER_TCS_BRD_1_ID), + "2": ("TMP1075 PL PCDU 0", TMP1075_HANDLER_PLPCDU_0_ID), + "4": ("TMP1075 IF Board", TMP1075_HANDLER_IF_BRD_ID), + } + input_helper = InputHelper(menu_dict) + tmp_select = input_helper.get_key() return pack_tmp1075_test_into( - object_id=object_id, q=queue_helper, op_code=op_code - ) - if service == CustomServiceList.TMP1075_2.value: - object_id = cast(ObjectIdU32, obj_id_man.get(TMP_1075_2_HANDLER_ID)) - return pack_tmp1075_test_into( - object_id=object_id, q=queue_helper, op_code=op_code + object_id=menu_dict[tmp_select][1], q=queue_helper, op_code=op_code ) if service == CustomServiceList.HEATER.value: object_id = HEATER_CONTROLLER_ID diff --git a/eive_tmtc/utility/input_helper.py b/eive_tmtc/utility/input_helper.py index dc8881a..4e2473a 100644 --- a/eive_tmtc/utility/input_helper.py +++ b/eive_tmtc/utility/input_helper.py @@ -6,13 +6,13 @@ @date 13.02.2021 """ import logging - +from typing import Tuple, Dict _LOGGER = logging.getLogger(__name__) class InputHelper: - def __init__(self, menu: dict): + def __init__(self, menu: Dict[str, Tuple[str, ...]]): """ @brief Constructor @param menu The menu describing the input options