From 5e0e51c2582c6f97804f30a85ecd8ca7d8327aff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 19:41:24 +0100 Subject: [PATCH] param update success --- config/cmd_definitions.py | 5 +++++ pus_tc/plpcdu.py | 14 +++++++++----- pus_tm/factory_hook.py | 3 +++ tmtccmd | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/config/cmd_definitions.py b/config/cmd_definitions.py index d89eeb7..3681f5e 100644 --- a/config/cmd_definitions.py +++ b/config/cmd_definitions.py @@ -104,6 +104,11 @@ def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): keys=OpCodes.SWITCH_ALL_ON, info="Switch all PL PCDU modules on", ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=OpCodes.UPDATE_DRO_TO_X8_WAIT, + info="Update DRO to X8 wait time", + ) add_service_op_code_entry( srv_op_code_dict=cmd_dict, name=CustomServiceList.PL_PCDU.value, diff --git a/pus_tc/plpcdu.py b/pus_tc/plpcdu.py index 6da84e1..41926a8 100644 --- a/pus_tc/plpcdu.py +++ b/pus_tc/plpcdu.py @@ -27,7 +27,8 @@ class Submodes(enum.IntEnum): class ParamIds(enum.IntEnum): - DRO_TO_X8_WAIT_TIME = 17 + SSR_TO_DRO_WAIT_TIME = 17 + DRO_TO_X8_WAIT_TIME = 18 def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): @@ -50,8 +51,10 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): ) tc_queue.appendleft(mode_cmd.pack_command_tuple()) if op_code in OpCodes.UPDATE_DRO_TO_X8_WAIT: - tc_queue.appendleft((QueueCommands.PRINT, "Updating DRO to X8 wait time")) wait_time = request_wait_time() + tc_queue.appendleft( + (QueueCommands.PRINT, f"Updating DRO to X8 wait time to {wait_time}") + ) if wait_time is None: return param_data = pack_scalar_double_param_app_data( @@ -66,13 +69,14 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): def request_wait_time() -> Optional[float]: while True: - wait_time = input("Please enter DRO to X8 wait time in seconds, x to cancel") + wait_time = input("Please enter DRO to X8 wait time in seconds, x to cancel: ") if wait_time.lower() == "x": return None - if not wait_time.isnumeric(): + try: + wait_time = float(wait_time) + except ValueError: LOGGER.warning("Invalid input") continue - wait_time = float(wait_time) if wait_time <= 0: LOGGER.warning("Invalid input") else: diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index f1556b4..38f9005 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -11,6 +11,7 @@ from tmtccmd.pus.service_1_verification import Service1TMExtended from tmtccmd.pus.service_17_test import Service17TMExtended from tmtccmd.tm.service_3_housekeeping import Service3TM from tmtccmd.tm.service_200_mode import Service200TM +from tmtccmd.tm.service_20_parameters import Service20TM from tmtccmd.tm.service_5_event import Service5TM from tmtccmd.tm.service_200_mode import Service200TM from tmtccmd.utility.tmtc_printer import TmTcPrinter, PrintFormats @@ -46,6 +47,8 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter): tm_packet = Service8TM.unpack(raw_telemetry=raw_tm_packet) if service_type == 17: tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet) + if service_type == 20: + tm_packet = Service20TM.unpack(raw_telemetry=raw_tm_packet) if service_type == 200: tm_packet = Service200TM.unpack(raw_telemetry=raw_tm_packet) if tm_packet is None: diff --git a/tmtccmd b/tmtccmd index 9af8340..8c4315c 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 9af8340c0276460128bd343139bc6e20bf020f6a +Subproject commit 8c4315c79fb7b7afecfb8e7ea9ccbf7847698468