From ec27380f167105d9e49fee915175134aad75c56c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 17:31:36 +0100 Subject: [PATCH] finsihed first param cmd definition --- pus_tc/plpcdu.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/pus_tc/plpcdu.py b/pus_tc/plpcdu.py index 6717aaa..bfb42ee 100644 --- a/pus_tc/plpcdu.py +++ b/pus_tc/plpcdu.py @@ -3,10 +3,15 @@ import enum from tmtccmd.config import QueueCommands from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc.service_200_mode import pack_mode_data, Modes, Subservices -from tmtccmd.tc.service_20_parameter import pack_boolean_parameter_command +from tmtccmd.tc.service_20_parameter import ( + pack_scalar_double_param_app_data, + pack_fsfw_load_param_cmd +) +from tmtccmd.utility.logger import get_console_logger from spacepackets.ecss.tc import PusTelecommand from config.object_ids import PL_PCDU_ID +LOGGER = get_console_logger() class OpCodes: SWITCH_ADC_ON = ["0", "switch-adc-on"] @@ -19,6 +24,10 @@ class Submodes(enum.IntEnum): ALL_ON = 1 +class ParamIds(enum.IntEnum): + DRO_TO_X8_WAIT_TIME = 17 + + def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.SWITCH_ADC_ON: tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU ADC module on")) @@ -40,4 +49,23 @@ 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")) - param_data = \ No newline at end of file + while True: + wait_time = input("Please enter DRO to X8 wait time in seconds, x to cancel") + if wait_time.lower() == "x": + return + if not wait_time.isnumeric(): + LOGGER.warning("Invalid input") + continue + wait_time = float(wait_time) + if wait_time <= 0: + LOGGER.warning("Invalid input") + else: + break + param_data = pack_scalar_double_param_app_data( + object_id=PL_PCDU_ID, + domain_id=0, + unique_id=ParamIds.DRO_TO_X8_WAIT_TIME, + parameter=wait_time + ) + cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data) + tc_queue.appendleft(cmd.pack_command_tuple())