From 57e1eb7c75ab592c10ad70d8a7e3a20cd3440b7e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Feb 2022 14:32:31 +0100 Subject: [PATCH 01/21] iupdate submodules --- spacepackets | 2 +- tmtccmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spacepackets b/spacepackets index 3265de6..8580a08 160000 --- a/spacepackets +++ b/spacepackets @@ -1 +1 @@ -Subproject commit 3265de69717e2f718f4c740d77a823f9811f8348 +Subproject commit 8580a08e9876efc542e19dc957f220be3b250dc8 diff --git a/tmtccmd b/tmtccmd index 49cf288..0a713b8 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 49cf288831216c0680aedab88e31d684ba5b8da8 +Subproject commit 0a713b8695c54008b28e1314a2618dc4ba051ff5 -- 2.43.0 From a671e86400152d8480c1efde29d69848ca6b6066 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Feb 2022 14:41:29 +0100 Subject: [PATCH 02/21] hk handling bugfix --- pus_tm/hk_handling.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py index 311a7eb..3691026 100644 --- a/pus_tm/hk_handling.py +++ b/pus_tm/hk_handling.py @@ -282,6 +282,8 @@ def handle_gps_data(hk_data: bytearray) -> HkReplyUnpacked: f"{datetime.datetime.now()}, {latitude}, {longitude}, {altitude}, " f"{fix_mode}, {sat_in_use}, {date_string}, {unix_seconds}\n" ) + reply.header_list = header_array + reply.content_list = content_array reply.validity_buffer = hk_data[37:39] return reply -- 2.43.0 From 7e24589184bb7bbd427c66ed55b3c29bbeba927f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 24 Feb 2022 10:56:36 +0100 Subject: [PATCH 03/21] added new core controller commands --- config/cmd_definitions.py | 48 +++++++++++++++++++--- pus_tc/core.py | 83 +++++++++++++++++++++++++++++++++------ pus_tc/pdu1.py | 8 +++- 3 files changed, 119 insertions(+), 20 deletions(-) diff --git a/config/cmd_definitions.py b/config/cmd_definitions.py index 589e581..3402dfa 100644 --- a/config/cmd_definitions.py +++ b/config/cmd_definitions.py @@ -38,12 +38,50 @@ def add_bpx_cmd_definitions(cmd_dict: ServiceOpCodeDictT): def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT): + from pus_tc.core import OpCodes + od = dict() - add_op_code_entry(op_code_dict=od, keys=["0", "reboot"], info="Reboot with Prompt") - add_op_code_entry(op_code_dict=od, keys=["1", "reboot_0_0"], info="Reboot 0 0") - add_op_code_entry(op_code_dict=od, keys=["2", "reboot_0_1"], info="Reboot 0 1") - add_op_code_entry(op_code_dict=od, keys=["3", "reboot_1_0"], info="Reboot 1 0") - add_op_code_entry(op_code_dict=od, keys=["4", "reboot_1_1"], info="Reboot 1 1") + add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT, info="Reboot with Prompt") + add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_SELF, info="Reboot Self") + add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_0_0, info="Reboot 0 0") + add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_0_1, info="Reboot 0 1") + add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_1_0, info="Reboot 1 0") + add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_1_1, info="Reboot 1 1") + add_op_code_entry( + op_code_dict=od, + keys=OpCodes.ENABLE_REBOOT_FILE_HANDLING, + info="Enable reboot file handling", + ) + add_op_code_entry( + op_code_dict=od, + keys=OpCodes.DISABLE_REBOOT_FILE_HANDLING, + info="Disable reboot file handling", + ) + add_op_code_entry( + op_code_dict=od, + keys=OpCodes.RESET_ALL_REBOOT_COUNTERS, + info="Reset all reboot counters", + ) + add_op_code_entry( + op_code_dict=od, + keys=OpCodes.RESET_REBOOT_COUNTER_00, + info="Reset reboot counter 0 0", + ) + add_op_code_entry( + op_code_dict=od, + keys=OpCodes.RESET_REBOOT_COUNTER_01, + info="Reset reboot counter 0 1", + ) + add_op_code_entry( + op_code_dict=od, + keys=OpCodes.RESET_REBOOT_COUNTER_10, + info="Reset reboot counter 1 0", + ) + add_op_code_entry( + op_code_dict=od, + keys=OpCodes.RESET_REBOOT_COUNTER_11, + info="Reset reboot counter 1 1", + ) add_service_op_code_entry( srv_op_code_dict=cmd_dict, name=CustomServiceList.CORE.value, diff --git a/pus_tc/core.py b/pus_tc/core.py index a30d528..338337b 100644 --- a/pus_tc/core.py +++ b/pus_tc/core.py @@ -10,16 +10,32 @@ LOGGER = get_console_logger() class ActionIds(enum.IntEnum): + LIST_DIR_INTO_FILE = 0 + SWITCH_REBOOT_FILE_HANDLING = 5 + RESET_ALL_REBOOT_COUNTERS = 6 + RESET_REBOOT_COUNTER_00 = 7 + RESET_REBOOT_COUNTER_01 = 8 + RESET_REBOOT_COUNTER_10 = 9 + RESET_REBOOT_COUNTER_11 = 10 + SET_MAX_REBOOT_CNT = 11 REBOOT = 32 -class OpCodes(enum.Enum): - REBOOT = "reboot" - REBOOT_SELF = "reboot_self" - REBOOT_0_0 = "reboot_0_0" - REBOOT_0_1 = "reboot_0_1" - REBOOT_1_0 = "reboot_1_0" - REBOOT_1_1 = "reboot_1_1" +class OpCodes: + REBOOT = ["0", "reboot"] + REBOOT_SELF = ["1", "reboot_self"] + REBOOT_0_0 = ["2", "reboot_0_0"] + REBOOT_0_1 = ["3", "reboot_0_1"] + REBOOT_1_0 = ["4", "reboot_1_0"] + REBOOT_1_1 = ["5", "reboot_1_1"] + ENABLE_REBOOT_FILE_HANDLING = ["6", "rbh-off"] + DISABLE_REBOOT_FILE_HANDLING = ["7", "rbh-on"] + RESET_ALL_REBOOT_COUNTERS = ["8", "rbh-reset-a"] + RESET_REBOOT_COUNTER_00 = ["9", "rbh-reset-00"] + RESET_REBOOT_COUNTER_01 = ["10", "rbh-reset-01"] + RESET_REBOOT_COUNTER_10 = ["11", "rbh-reset-10"] + RESET_REBOOT_COUNTER_11 = ["12", "rbh-reset-11"] + SET_MAX_REBOOT_CNT = ["13", "rbh-max-cnt"] class Chip(enum.IntEnum): @@ -35,7 +51,7 @@ class Copy(enum.IntEnum): def pack_core_commands(tc_queue: TcQueueT, op_code: str): - if op_code == OpCodes.REBOOT.value: + if op_code in OpCodes.REBOOT: reboot_self, chip_select, copy_select = determine_reboot_params() perform_reboot_cmd( tc_queue=tc_queue, @@ -43,30 +59,71 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str): chip=chip_select, copy=copy_select, ) - elif op_code == OpCodes.REBOOT_SELF.value: + elif op_code in OpCodes.REBOOT_SELF: perform_reboot_cmd(tc_queue=tc_queue, reboot_self=True) - elif op_code == OpCodes.REBOOT_0_0.value: + elif op_code in OpCodes.REBOOT_0_0: perform_reboot_cmd( tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM ) - elif op_code == OpCodes.REBOOT_0_1.value: + elif op_code in OpCodes.REBOOT_0_1: perform_reboot_cmd( tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_1_GOLD, ) - elif op_code == OpCodes.REBOOT_1_0.value: + elif op_code in OpCodes.REBOOT_1_0: perform_reboot_cmd( tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_0_NOM ) - elif op_code == OpCodes.REBOOT_1_1.value: + elif op_code in OpCodes.REBOOT_1_1: perform_reboot_cmd( tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_1_GOLD, ) + elif op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING: + tc_queue.appendleft((QueueCommands.PRINT, "Disabling reboot file handling")) + app_data = bytearray([0]) + generate_action_command( + object_id=CORE_CONTROLLER_ID, + action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING, + app_data=app_data, + ) + elif op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING: + tc_queue.appendleft((QueueCommands.PRINT, "Enabling reboot file handling")) + app_data = bytearray([1]) + generate_action_command( + object_id=CORE_CONTROLLER_ID, + action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING, + app_data=app_data, + ) + elif op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS: + tc_queue.appendleft((QueueCommands.PRINT, "Resetting all reboot counters")) + generate_action_command( + object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_ALL_REBOOT_COUNTERS + ) + elif op_code in OpCodes.RESET_REBOOT_COUNTER_00: + tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 0 0")) + generate_action_command( + object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_00 + ) + elif op_code in OpCodes.RESET_REBOOT_COUNTER_01: + tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 0 1")) + generate_action_command( + object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_01 + ) + elif op_code in OpCodes.RESET_REBOOT_COUNTER_10: + tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 1 0")) + generate_action_command( + object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_10 + ) + elif op_code in OpCodes.RESET_REBOOT_COUNTER_11: + tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 1 1")) + generate_action_command( + object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_11 + ) def determine_reboot_params() -> (bool, Chip, Copy): diff --git a/pus_tc/pdu1.py b/pus_tc/pdu1.py index 95419f6..1df00fe 100644 --- a/pus_tc/pdu1.py +++ b/pus_tc/pdu1.py @@ -134,7 +134,9 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): ) tc_queue.appendleft(command.pack_command_tuple()) if op_code == Pdu1OpCodes.SCEX_ON.value: - tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Solar Cell Experiment on")) + tc_queue.appendleft( + (QueueCommands.PRINT, "PDU1: Turn Solar Cell Experiment on") + ) command = pack_set_param_command( object_id, PDUConfigTable.out_en_5.parameter_address, @@ -143,7 +145,9 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): ) tc_queue.appendleft(command.pack_command_tuple()) if op_code == Pdu1OpCodes.SCEX_OFF.value: - tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Solar Cell Experiment off")) + tc_queue.appendleft( + (QueueCommands.PRINT, "PDU1: Turn Solar Cell Experiment off") + ) command = pack_set_param_command( object_id, PDUConfigTable.out_en_5.parameter_address, -- 2.43.0 From b8d666a18382bd61067f5d9667f77c78fb2c1ed1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 25 Feb 2022 19:21:32 +0100 Subject: [PATCH 04/21] add plpcdu commands --- config/object_ids.py | 1 + pus_tc/plpcdu.py | 38 ++++++++++++++++++++++++++++++++++++++ tmtccmd | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 pus_tc/plpcdu.py diff --git a/config/object_ids.py b/config/object_ids.py index 2bbe62d..63e9732 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -56,6 +56,7 @@ PLOC_UPDATER_ID = bytes([0x44, 0x33, 0x00, 0x00]) PLOC_MEMORY_DUMPER_ID = bytes([0x44, 0x33, 0x00, 0x01]) STR_IMG_HELPER_ID = bytes([0x44, 0x33, 0x00, 0x02]) PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15]) +PL_PCDU_ID = bytes([0x44, 0x30, 0x00, 0x00]) def get_object_ids() -> Dict[bytes, list]: diff --git a/pus_tc/plpcdu.py b/pus_tc/plpcdu.py new file mode 100644 index 0000000..e18a993 --- /dev/null +++ b/pus_tc/plpcdu.py @@ -0,0 +1,38 @@ +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 spacepackets.ecss.tc import PusTelecommand +from config.object_ids import PL_PCDU_ID + + +class OpCodes: + SWITCH_ADC_ON = ["0", "switch-adc-on"] + SWITCH_ALL_ON = ["1", "switch-all-on"] + + +class Submodes(enum.IntEnum): + ADC_ON = 0 + ALL_ON = 1 + + +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")) + mode_data = pack_mode_data( + object_id=PL_PCDU_ID, mode=Modes.NORMAL, submode=Submodes.ADC_ON + ) + mode_cmd = PusTelecommand( + service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data + ) + tc_queue.appendleft(mode_cmd.pack_command_tuple()) + if op_code in OpCodes.SWITCH_ALL_ON: + tc_queue.appendleft((QueueCommands.PRINT, "Switching all PL PCDU modules on")) + mode_data = pack_mode_data( + object_id=PL_PCDU_ID, mode=Modes.NORMAL, submode=Submodes.ALL_ON + ) + mode_cmd = PusTelecommand( + service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data + ) + tc_queue.appendleft(mode_cmd.pack_command_tuple()) diff --git a/tmtccmd b/tmtccmd index 0a713b8..f7bbf4b 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 0a713b8695c54008b28e1314a2618dc4ba051ff5 +Subproject commit f7bbf4bd9f6dc169a8b9e6a76fa9ef0aceb341d4 -- 2.43.0 From 02848468678535f84e886b90f986da6a72edf1a7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 25 Feb 2022 19:25:14 +0100 Subject: [PATCH 05/21] added PL PCDU tcs --- config/cmd_definitions.py | 13 +++++++++++++ config/definitions.py | 1 + config/hook_implementations.py | 2 ++ pus_tc/tc_packer_hook.py | 3 +++ 4 files changed, 19 insertions(+) diff --git a/config/cmd_definitions.py b/config/cmd_definitions.py index 3402dfa..63b10b1 100644 --- a/config/cmd_definitions.py +++ b/config/cmd_definitions.py @@ -90,6 +90,19 @@ def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT): ) +def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): + from pus_tc.plpcdu import OpCodes + op_code_dict = dict() + add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.SWITCH_ADC_ON, info="Switch PL PCDU ADC on") + add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.SWITCH_ALL_ON, info="Switch all PL PCDU modules on") + add_service_op_code_entry( + srv_op_code_dict=cmd_dict, + name=CustomServiceList.PL_PCDU.value, + info="PL PCDU", + op_code_entry=op_code_dict, + ) + + def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): from pus_tc.p60dock import P60OpCodes, GomspaceOpCodes from pus_tc.pdu1 import Pdu1OpCodes diff --git a/config/definitions.py b/config/definitions.py index 3a104aa..d1a2cdf 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -24,6 +24,7 @@ class CustomServiceList(enum.Enum): IMTQ = "imtq" PLOC = "ploc" PCDU = "pcdu" + PL_PCDU = "plpcdu" SA_DEPLYOMENT = "sa_depl" REACTION_WHEEL_1 = "reaction_wheel_1" REACTION_WHEEL_2 = "reaction_wheel_2" diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 9fa73ef..2090cc0 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -114,11 +114,13 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): add_bpx_cmd_definitions, add_core_controller_definitions, add_pcdu_cmds, + add_pl_pcdu_cmds ) from pus_tc.gps import GpsOpCodes add_bpx_cmd_definitions(cmd_dict=service_op_code_dict) add_core_controller_definitions(cmd_dict=service_op_code_dict) + add_pl_pcdu_cmds(cmd_dict=service_op_code_dict) op_code_dict = { GpsOpCodes.RESET_GNSS.value: ("Reset GPS", {OpCodeDictKeys.TIMEOUT: 2.0}) diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 0989deb..40a2fb7 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -31,6 +31,7 @@ from pus_tc.star_tracker import pack_star_tracker_commands from pus_tc.syrlinks_hk_handler import pack_syrlinks_command from pus_tc.gps import pack_gps_command from pus_tc.acs import pack_acs_command +from pus_tc.plpcdu import pack_pl_pcdu_commands from pus_tc.str_img_helper import pack_str_img_helper_command from config.definitions import CustomServiceList from config.object_ids import ( @@ -192,6 +193,8 @@ def pack_service_queue_user( return pack_syrlinks_command( object_id=SYRLINKS_HANDLER_ID, tc_queue=service_queue, op_code=op_code ) + if service == CustomServiceList.PL_PCDU.value: + return pack_pl_pcdu_commands(tc_queue=service_queue, op_code=op_code) LOGGER.warning("Invalid Service !") -- 2.43.0 From 1238df03834b0b9ddbe2a59565de493661f5476e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 25 Feb 2022 19:27:39 +0100 Subject: [PATCH 06/21] enabled mode command handling --- pus_tm/factory_hook.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index 74d73dd..2e1f726 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -10,6 +10,7 @@ from tmtccmd.utility.logger import get_console_logger 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_5_event import Service5TM from tmtccmd.utility.tmtc_printer import TmTcPrinter, PrintFormats @@ -44,6 +45,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 == 200: + tm_packet = Service200TM.unpack(raw_telemetry=raw_tm_packet) if tm_packet is None: LOGGER.info( f"The service {service_type} is not implemented in Telemetry Factory" -- 2.43.0 From fd01098345b8c8059235f5699168345001b06ba1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 17:25:50 +0100 Subject: [PATCH 07/21] spacepackets and tmtc update --- lint.py | 31 +++++++++++++++++++++++-------- pus_tc/plpcdu.py | 5 +++++ pus_tc/star_tracker.py | 4 +++- spacepackets | 2 +- tmtccmd | 2 +- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/lint.py b/lint.py index 25bfdce..27291b2 100755 --- a/lint.py +++ b/lint.py @@ -4,18 +4,33 @@ import sys def main(): - # Ignore folder created by venv - exclude_dirs_flag = "--exclude bin,lib" + exclude_dirs_flag = "" + if not os.path.exists("setup.cfg"): + exclude_dirs_flag = ( + "--exclude .git,__pycache__,docs/conf.py,old,build,dist,venv" + ) additional_flags_both_steps = "--count --statistics" additional_flags_first_step = "--select=E9,F63,F7,F82 --show-source" - flake8_first_step_cmd = f"flake8 . {additional_flags_both_steps} {additional_flags_first_step} {exclude_dirs_flag}" + flake8_first_step_cmd = ( + f"flake8 . {additional_flags_both_steps} " + f"{additional_flags_first_step} {exclude_dirs_flag}" + ) status = os.system(flake8_first_step_cmd) - if os.WEXITSTATUS(status) != 0: - print("Flake8 linter errors") - sys.exit(0) + if os.name == "nt": + if status != 0: + print(f"Flake8 linter errors with status {status}") + else: + if os.WEXITSTATUS(status) != 0: + print(f"Flake8 linter errors with status {status}") + sys.exit(0) + additional_flags_second_step = ( + '--exit-zero --max-complexity=10 --per-file-ignores="__init__.py:F401"' + ) + if not os.path.exists("setup.cfg"): + additional_flags_second_step += " --max-line-length=100" flake8_second_step_cmd = ( - f"flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 " - f"--max-line-length=127 {exclude_dirs_flag}" + f"flake8 . {additional_flags_both_steps} {additional_flags_second_step}" + f" {exclude_dirs_flag}" ) os.system(flake8_second_step_cmd) diff --git a/pus_tc/plpcdu.py b/pus_tc/plpcdu.py index e18a993..6717aaa 100644 --- a/pus_tc/plpcdu.py +++ b/pus_tc/plpcdu.py @@ -3,6 +3,7 @@ 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 spacepackets.ecss.tc import PusTelecommand from config.object_ids import PL_PCDU_ID @@ -10,6 +11,7 @@ from config.object_ids import PL_PCDU_ID class OpCodes: SWITCH_ADC_ON = ["0", "switch-adc-on"] SWITCH_ALL_ON = ["1", "switch-all-on"] + UPDATE_DRO_TO_X8_WAIT = ["2", "dro-to-x8-wait"] class Submodes(enum.IntEnum): @@ -36,3 +38,6 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data ) 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 diff --git a/pus_tc/star_tracker.py b/pus_tc/star_tracker.py index 42b7dbf..fdf693d 100644 --- a/pus_tc/star_tracker.py +++ b/pus_tc/star_tracker.py @@ -95,7 +95,9 @@ class FileDefs: ) q7s_ground_config = "/mnt/sd0/startracker/json/ground-config.json" q7s_flight_config = "/mnt/sd0/startracker/flight-config.json" - + firmware2_1 = "" + firmware22_1 = "" + firmware_origin = "" json_dict = { "1": ["Q7S flight config", FileDefs.q7s_flight_config], diff --git a/spacepackets b/spacepackets index 8580a08..19e8a58 160000 --- a/spacepackets +++ b/spacepackets @@ -1 +1 @@ -Subproject commit 8580a08e9876efc542e19dc957f220be3b250dc8 +Subproject commit 19e8a588fa0723a5991f80bb2fd52dfc64f0ac64 diff --git a/tmtccmd b/tmtccmd index f7bbf4b..9af8340 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit f7bbf4bd9f6dc169a8b9e6a76fa9ef0aceb341d4 +Subproject commit 9af8340c0276460128bd343139bc6e20bf020f6a -- 2.43.0 From ec27380f167105d9e49fee915175134aad75c56c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 17:31:36 +0100 Subject: [PATCH 08/21] 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()) -- 2.43.0 From a9a6468718e5ecde52a1092eb73ae79c2219a1a0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 18:00:39 +0100 Subject: [PATCH 09/21] separate request wait time function --- pus_tc/plpcdu.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/pus_tc/plpcdu.py b/pus_tc/plpcdu.py index bfb42ee..40371ce 100644 --- a/pus_tc/plpcdu.py +++ b/pus_tc/plpcdu.py @@ -1,4 +1,5 @@ import enum +from typing import Optional from tmtccmd.config import QueueCommands from tmtccmd.tc.definitions import TcQueueT @@ -13,6 +14,7 @@ from config.object_ids import PL_PCDU_ID LOGGER = get_console_logger() + class OpCodes: SWITCH_ADC_ON = ["0", "switch-adc-on"] SWITCH_ALL_ON = ["1", "switch-all-on"] @@ -49,18 +51,9 @@ 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")) - 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 + wait_time = request_wait_time() + if wait_time is None: + return param_data = pack_scalar_double_param_app_data( object_id=PL_PCDU_ID, domain_id=0, @@ -69,3 +62,18 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): ) cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data) tc_queue.appendleft(cmd.pack_command_tuple()) + + +def request_wait_time() -> Optional[float]: + while True: + 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(): + LOGGER.warning("Invalid input") + continue + wait_time = float(wait_time) + if wait_time <= 0: + LOGGER.warning("Invalid input") + else: + return wait_time -- 2.43.0 From 5bea19a09af7f8cdf64e2821b2e2a7da1a47ae7e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 18:12:31 +0100 Subject: [PATCH 10/21] ran black --- config/cmd_definitions.py | 13 +++++++++++-- config/hook_implementations.py | 12 +++++++++--- pus_tc/plpcdu.py | 4 ++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/config/cmd_definitions.py b/config/cmd_definitions.py index 63b10b1..d89eeb7 100644 --- a/config/cmd_definitions.py +++ b/config/cmd_definitions.py @@ -92,9 +92,18 @@ def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT): def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): from pus_tc.plpcdu import OpCodes + op_code_dict = dict() - add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.SWITCH_ADC_ON, info="Switch PL PCDU ADC on") - add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.SWITCH_ALL_ON, info="Switch all PL PCDU modules on") + add_op_code_entry( + op_code_dict=op_code_dict, + keys=OpCodes.SWITCH_ADC_ON, + info="Switch PL PCDU ADC on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=OpCodes.SWITCH_ALL_ON, + info="Switch all PL PCDU modules on", + ) add_service_op_code_entry( srv_op_code_dict=cmd_dict, name=CustomServiceList.PL_PCDU.value, diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 01527a4..b47cd3f 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -114,7 +114,7 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): add_bpx_cmd_definitions, add_core_controller_definitions, add_pcdu_cmds, - add_pl_pcdu_cmds + add_pl_pcdu_cmds, ) from pus_tc.gps import GpsOpCodes @@ -426,8 +426,14 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): {OpCodeDictKeys.TIMEOUT: 2.0}, ), "69": ("Star Tracker: Firmware update", {OpCodeDictKeys.TIMEOUT: 2.0}), - "70": ("Star Tracker: Disable timestamp generation", {OpCodeDictKeys.TIMEOUT: 2.0}), - "71": ("Star Tracker: Enable timestamp generation", {OpCodeDictKeys.TIMEOUT: 2.0}), + "70": ( + "Star Tracker: Disable timestamp generation", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "71": ( + "Star Tracker: Enable timestamp generation", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), } service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker) diff --git a/pus_tc/plpcdu.py b/pus_tc/plpcdu.py index 40371ce..6da84e1 100644 --- a/pus_tc/plpcdu.py +++ b/pus_tc/plpcdu.py @@ -6,7 +6,7 @@ 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_scalar_double_param_app_data, - pack_fsfw_load_param_cmd + pack_fsfw_load_param_cmd, ) from tmtccmd.utility.logger import get_console_logger from spacepackets.ecss.tc import PusTelecommand @@ -58,7 +58,7 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): object_id=PL_PCDU_ID, domain_id=0, unique_id=ParamIds.DRO_TO_X8_WAIT_TIME, - parameter=wait_time + parameter=wait_time, ) cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data) tc_queue.appendleft(cmd.pack_command_tuple()) -- 2.43.0 From 5e0e51c2582c6f97804f30a85ecd8ca7d8327aff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 19:41:24 +0100 Subject: [PATCH 11/21] 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 -- 2.43.0 From 9fff4a90bcacb04eea64ac2d3456889c05a4b16d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 19:42:27 +0100 Subject: [PATCH 12/21] tmtccmd update --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index 8c4315c..efa1e66 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 8c4315c79fb7b7afecfb8e7ea9ccbf7847698468 +Subproject commit efa1e6636e3577579564ce496b66136a009bfa94 -- 2.43.0 From 06a36368665ccbc1aa7407176c6e12a01cde3bfa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Mar 2022 10:09:57 +0100 Subject: [PATCH 13/21] some TM packet names changed --- pus_tm/factory_hook.py | 21 ++++++++++----------- pus_tm/hk_handling.py | 2 +- tmtccmd | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index 38f9005..5a2de0f 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -3,17 +3,16 @@ @details Template configuration file. Copy this folder to the TMTC commander root and adapt it to your needs. """ -from tmtccmd.tm.service_8_functional_cmd import Service8TM +from tmtccmd.tm.service_8_fsfw_functional_cmd import Service8FsfwTm from spacepackets.ecss.tm import PusTelemetry from tmtccmd.utility.logger import get_console_logger 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.tm.service_3_fsfw_housekeeping import Service3FsfwTm +from tmtccmd.tm.service_20_fsfw_parameters import Service20FsfwTm +from tmtccmd.tm.service_5_event import Service5Tm +from tmtccmd.tm.service_200_mode import Service200Tm from tmtccmd.utility.tmtc_printer import TmTcPrinter, PrintFormats from config.definitions import PUS_APID @@ -38,19 +37,19 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter): if service_type == 1: tm_packet = Service1TMExtended.unpack(raw_telemetry=raw_tm_packet) if service_type == 3: - tm_packet = Service3TM.unpack( + tm_packet = Service3FsfwTm.unpack( raw_telemetry=raw_tm_packet, custom_hk_handling=False ) if service_type == 5: - tm_packet = Service5TM.unpack(raw_telemetry=raw_tm_packet) + tm_packet = Service5Tm.unpack(raw_telemetry=raw_tm_packet) if service_type == 8: - tm_packet = Service8TM.unpack(raw_telemetry=raw_tm_packet) + tm_packet = Service8FsfwTm.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) + tm_packet = Service20FsfwTm.unpack(raw_telemetry=raw_tm_packet) if service_type == 200: - tm_packet = Service200TM.unpack(raw_telemetry=raw_tm_packet) + tm_packet = Service200Tm.unpack(raw_telemetry=raw_tm_packet) if tm_packet is None: LOGGER.info( f"The service {service_type} is not implemented in Telemetry Factory" diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py index 3691026..6cac660 100644 --- a/pus_tm/hk_handling.py +++ b/pus_tm/hk_handling.py @@ -4,7 +4,7 @@ import os import datetime from tmtccmd.config.definitions import HkReplyUnpacked -from tmtccmd.tm.service_3_housekeeping import Service3Base +from tmtccmd.tm.service_3_fsfw_housekeeping import Service3Base from tmtccmd.utility.logger import get_console_logger from pus_tc.bpx_batt import BpxSetIds from pus_tc.syrlinks_hk_handler import SetIds diff --git a/tmtccmd b/tmtccmd index efa1e66..027225b 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit efa1e6636e3577579564ce496b66136a009bfa94 +Subproject commit 027225b83a86123d23e16966fe0d3881e7ee8d64 -- 2.43.0 From 7c98e0c57048d6d8e3f951f31c3d7f264cef17f0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Mar 2022 10:31:28 +0100 Subject: [PATCH 14/21] update requirements.txt --- requirements.txt | 2 +- tmtccmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4545207..c634e6a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -tmtccmd>=1.11.0 +tmtccmd>=1.12.0 diff --git a/tmtccmd b/tmtccmd index 027225b..c9e0373 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 027225b83a86123d23e16966fe0d3881e7ee8d64 +Subproject commit c9e0373e9057213b36f058200129c1edb3d2173e -- 2.43.0 From 3190d796e1345f3a31a2ae1e2edf646f4966cb12 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Mar 2022 11:26:18 +0100 Subject: [PATCH 15/21] added PL PCDU parameters --- pus_tc/plpcdu.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pus_tc/plpcdu.py b/pus_tc/plpcdu.py index 41926a8..6ee1a66 100644 --- a/pus_tc/plpcdu.py +++ b/pus_tc/plpcdu.py @@ -27,8 +27,41 @@ class Submodes(enum.IntEnum): class ParamIds(enum.IntEnum): + NEG_V_LOWER_BOUND = 0 + NEG_V_UPPER_BOUND = 1 + + DRO_U_LOWER_BOUND = 2 + DRO_U_UPPER_BOUND = 3 + DRO_I_UPPER_BOUND = 4 + + X8_U_LOWER_BOUND = 5 + X8_U_UPPER_BOUND = 6 + X8_I_UPPER_BOUND = 7 + + TX_U_LOWER_BOUND = 8 + TX_U_UPPER_BOUND = 9 + TX_I_UPPER_BOUND = 10 + + MPA_U_LOWER_BOUND = 11 + MPA_U_UPPER_BOUND = 12 + MPA_I_UPPER_BOUND = 13 + + HPA_U_LOWER_BOUND = 14 + HPA_U_UPPER_BOUND = 15 + HPA_I_UPPER_BOUND = 16 + SSR_TO_DRO_WAIT_TIME = 17 DRO_TO_X8_WAIT_TIME = 18 + X8_TO_TX_WAIT_TIME = 19 + TX_TO_MPA_WAIT_TIME = 20 + MPA_TO_HPA_WAIT_TIME = 21 + + INJECT_SSR_TO_DRO_FAILURE = 30 + INJECT_DRO_TO_X8_FAILURE = 31 + INJECT_X8_TO_TX_FAILURE = 32 + INJECT_TX_TO_MPA_FAILURE = 33 + INJECT_MPA_TO_HPA_FAILURE = 34 + INJECT_ALL_ON_FAILURE = 35 def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): -- 2.43.0 From 3c3a5ab03caeed5150c2b40293ea1770a48b5476 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Mar 2022 11:27:17 +0100 Subject: [PATCH 16/21] tmtccmd update --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index c9e0373..dbba7ed 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit c9e0373e9057213b36f058200129c1edb3d2173e +Subproject commit dbba7edf6f69950d8160cccb1a68210d4c35c199 -- 2.43.0 From 847e2a4c152c5a007124248fac9362e6b73d2eb1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Mar 2022 11:44:39 +0100 Subject: [PATCH 17/21] moved some more commands --- config/cmd_definitions.py | 171 +++++++++++++++++++++++++++++++ config/hook_implementations.py | 177 ++------------------------------- pus_tc/plpcdu.py | 46 ++++++--- 3 files changed, 214 insertions(+), 180 deletions(-) diff --git a/config/cmd_definitions.py b/config/cmd_definitions.py index 3681f5e..03b7dd8 100644 --- a/config/cmd_definitions.py +++ b/config/cmd_definitions.py @@ -302,3 +302,174 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): info="PDU2 Device", op_code_entry=op_code_dict, ) + + +def add_imtq_cmds(cmd_dict: ServiceOpCodeDictT): + op_code_dict_srv_imtq = { + "0": ("IMTQ Tests All", {OpCodeDictKeys.TIMEOUT: 2.0}), + "1": ("IMTQ perform pos X self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "2": ("IMTQ perform neg X self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "3": ("IMTQ perform pos Y self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "4": ("IMTQ perform neg Y self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "5": ("IMTQ perform pos Z self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "6": ("IMTQ perform neg Z self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "7": ("IMTQ command dipole", {OpCodeDictKeys.TIMEOUT: 2.0}), + "8": ("IMTQ get commanded dipole", {OpCodeDictKeys.TIMEOUT: 2.0}), + } + service_imtq_tuple = ("IMTQ Device", op_code_dict_srv_imtq) + cmd_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple + + +def add_rw_cmds(cmd_dict: ServiceOpCodeDictT): + op_code_dict_srv_rw = { + "0": ("Reaction Wheel: Run all commands", {OpCodeDictKeys.TIMEOUT: 2.0}), + "1": ("Reaction Wheel: Set speed", {OpCodeDictKeys.TIMEOUT: 2.0}), + "2": ("Reaction Wheel: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), + "3": ("Reaction Wheel: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), + "4": ("Reaction Wheel: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), + "5": ( + "Reaction Wheel: Send get-telemetry-command", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + } + service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw) + cmd_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple + cmd_dict[CustomServiceList.REACTION_WHEEL_2.value] = service_rw_tuple + cmd_dict[CustomServiceList.REACTION_WHEEL_3.value] = service_rw_tuple + cmd_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple + + +def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT): + op_code_dict_srv_rad_sensor = { + "0": ("Radiation Sensor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), + "1": ("Radiation Sensor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), + "2": ("Radiation Sensor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), + } + service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor) + cmd_dict[CustomServiceList.RAD_SENSOR] = service_rad_sensor_tuple + + +def add_ploc_cmds(cmd_dict: ServiceOpCodeDictT): + op_code_dict_ploc_mem_dumper = { + "0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}), + } + service_ploc_memory_dumper_tuple = ( + "PLOC Memory Dumper", + op_code_dict_ploc_mem_dumper, + ) + + op_code_dict_srv_ploc_supv = { + "0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), + "1": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), + "2": ("PLOC Supervisor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), + "3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}), + "4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), + "5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), + "6": ("PLOC Supervisor: Shutdown MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), + "7": ( + "PLOC Supervisor: Select MPSoC boot image", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "8": ("PLOC Supervisor: Set max restart tries", {OpCodeDictKeys.TIMEOUT: 2.0}), + "9": ("PLOC Supervisor: Reset MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), + "10": ("PLOC Supervisor: Set time reference", {OpCodeDictKeys.TIMEOUT: 2.0}), + "11": ("PLOC Supervisor: Set boot timeout", {OpCodeDictKeys.TIMEOUT: 2.0}), + "12": ("PLOC Supervisor: Disable Hk", {OpCodeDictKeys.TIMEOUT: 2.0}), + "13": ( + "PLOC Supervisor: Request boot status report", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "14": ("PLOC Supervisor: Update available", {OpCodeDictKeys.TIMEOUT: 2.0}), + "15": ("PLOC Supervisor: Watchdogs enable", {OpCodeDictKeys.TIMEOUT: 2.0}), + "16": ( + "PLOC Supervisor: Watchdog Configure Timeout", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "17": ("PLOC Supervisor: Enable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}), + "18": ("PLOC Supervisor: Disable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}), + "19": ("PLOC Supervisor: Auto calibrate alert", {OpCodeDictKeys.TIMEOUT: 2.0}), + "20": ("PLOC Supervisor: Set alert limit", {OpCodeDictKeys.TIMEOUT: 2.0}), + "21": ("PLOC Supervisor: Set alert irq filter", {OpCodeDictKeys.TIMEOUT: 2.0}), + "22": ("PLOC Supervisor: Set ADC sweep period", {OpCodeDictKeys.TIMEOUT: 2.0}), + "23": ( + "PLOC Supervisor: Set ADC enabled channels", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "24": ( + "PLOC Supervisor: Set ADC window and stride", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "25": ("PLOC Supervisor: Set ADC threshold", {OpCodeDictKeys.TIMEOUT: 2.0}), + "26": ( + "PLOC Supervisor: Request latchup status report", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "27": ("PLOC Supervisor: Copy ADC data to MRAM", {OpCodeDictKeys.TIMEOUT: 2.0}), + "28": ( + "PLOC Supervisor: Enable/Disable NVM0/1/3", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "29": ("PLOC Supervisor: Select NVM", {OpCodeDictKeys.TIMEOUT: 2.0}), + "30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}), + "31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}), + "33": ("PLOC Supervisor: Print CPU stats", {OpCodeDictKeys.TIMEOUT: 2.0}), + "34": ("PLOC Supervisor: Set debug verbosity", {OpCodeDictKeys.TIMEOUT: 2.0}), + "35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), + "36": ("PLOC Supervisor: Read GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), + "37": ("PLOC Supervisor: Restart supervisor", {OpCodeDictKeys.TIMEOUT: 2.0}), + "38": ( + "PLOC Supervisor: Factory reset clear all", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "39": ( + "PLOC Supervisor: Factory reset clear mirror entries", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "40": ( + "PLOC Supervisor: Factory reset clear circular entries", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "41": ("PLOC Supervisor: CAN loopback test", {OpCodeDictKeys.TIMEOUT: 2.0}), + } + service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv) + + op_code_dict_srv_ploc_updater = { + "0": ( + "Ploc Updater: Update uboot on partition A", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "1": ( + "Ploc Updater: Update bitstream on partition A", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "2": ( + "Ploc Updater: Update linux on partition A", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "3": ( + "Ploc Updater: Update application on partition A", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "4": ( + "Ploc Updater: Update uboot on partition B", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "5": ( + "Ploc Updater: Update bitstream on partition B", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "6": ( + "Ploc Updater: Update linux on partition B", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + "7": ( + "Ploc Updater: Update application on partition B", + {OpCodeDictKeys.TIMEOUT: 2.0}, + ), + } + service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater) + cmd_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple + cmd_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple + cmd_dict[ + CustomServiceList.PLOC_MEMORY_DUMPER.value + ] = service_ploc_memory_dumper_tuple diff --git a/config/hook_implementations.py b/config/hook_implementations.py index b47cd3f..03f7b8a 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -115,12 +115,22 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): add_core_controller_definitions, add_pcdu_cmds, add_pl_pcdu_cmds, + add_imtq_cmds, + add_rw_cmds, + add_rad_sens_cmds, + add_ploc_cmds, ) from pus_tc.gps import GpsOpCodes add_bpx_cmd_definitions(cmd_dict=service_op_code_dict) add_core_controller_definitions(cmd_dict=service_op_code_dict) add_pl_pcdu_cmds(cmd_dict=service_op_code_dict) + add_pcdu_cmds(cmd_dict=service_op_code_dict) + add_imtq_cmds(cmd_dict=service_op_code_dict) + add_rad_sens_cmds(cmd_dict=service_op_code_dict) + add_rw_cmds(cmd_dict=service_op_code_dict) + add_rad_sens_cmds(cmd_dict=service_op_code_dict) + add_ploc_cmds(cmd_dict=service_op_code_dict) op_code_dict = { GpsOpCodes.RESET_GNSS.value: ("Reset GPS", {OpCodeDictKeys.TIMEOUT: 2.0}) @@ -144,165 +154,11 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): service_tuple = ("TMP1075 2", op_code_dict) service_op_code_dict[CustomServiceList.TMP1075_2.value] = service_tuple - add_pcdu_cmds(cmd_dict=service_op_code_dict) - op_code_dict_srv_heater = { "0": ("Heater Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_heater_tuple = ("Heater Device", op_code_dict_srv_heater) - op_code_dict_srv_imtq = { - "0": ("IMTQ Tests All", {OpCodeDictKeys.TIMEOUT: 2.0}), - "1": ("IMTQ perform pos X self test", {OpCodeDictKeys.TIMEOUT: 2.0}), - "2": ("IMTQ perform neg X self test", {OpCodeDictKeys.TIMEOUT: 2.0}), - "3": ("IMTQ perform pos Y self test", {OpCodeDictKeys.TIMEOUT: 2.0}), - "4": ("IMTQ perform neg Y self test", {OpCodeDictKeys.TIMEOUT: 2.0}), - "5": ("IMTQ perform pos Z self test", {OpCodeDictKeys.TIMEOUT: 2.0}), - "6": ("IMTQ perform neg Z self test", {OpCodeDictKeys.TIMEOUT: 2.0}), - "7": ("IMTQ command dipole", {OpCodeDictKeys.TIMEOUT: 2.0}), - "8": ("IMTQ get commanded dipole", {OpCodeDictKeys.TIMEOUT: 2.0}), - } - service_imtq_tuple = ("IMTQ Device", op_code_dict_srv_imtq) - - op_code_dict_srv_rw = { - "0": ("Reaction Wheel: Run all commands", {OpCodeDictKeys.TIMEOUT: 2.0}), - "1": ("Reaction Wheel: Set speed", {OpCodeDictKeys.TIMEOUT: 2.0}), - "2": ("Reaction Wheel: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), - "3": ("Reaction Wheel: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), - "4": ("Reaction Wheel: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), - "5": ( - "Reaction Wheel: Send get-telemetry-command", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - } - service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw) - - op_code_dict_srv_rad_sensor = { - "0": ("Radiation Sensor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), - "1": ("Radiation Sensor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), - "2": ("Radiation Sensor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), - } - service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor) - - op_code_dict_ploc_mem_dumper = { - "0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}), - } - service_ploc_memory_dumper_tuple = ( - "Radiation Sensor", - op_code_dict_ploc_mem_dumper, - ) - - op_code_dict_srv_ploc_supv = { - "0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), - "1": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), - "2": ("PLOC Supervisor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), - "3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}), - "4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), - "5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), - "6": ("PLOC Supervisor: Shutdown MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), - "7": ( - "PLOC Supervisor: Select MPSoC boot image", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "8": ("PLOC Supervisor: Set max restart tries", {OpCodeDictKeys.TIMEOUT: 2.0}), - "9": ("PLOC Supervisor: Reset MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), - "10": ("PLOC Supervisor: Set time reference", {OpCodeDictKeys.TIMEOUT: 2.0}), - "11": ("PLOC Supervisor: Set boot timeout", {OpCodeDictKeys.TIMEOUT: 2.0}), - "12": ("PLOC Supervisor: Disable Hk", {OpCodeDictKeys.TIMEOUT: 2.0}), - "13": ( - "PLOC Supervisor: Request boot status report", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "14": ("PLOC Supervisor: Update available", {OpCodeDictKeys.TIMEOUT: 2.0}), - "15": ("PLOC Supervisor: Watchdogs enable", {OpCodeDictKeys.TIMEOUT: 2.0}), - "16": ( - "PLOC Supervisor: Watchdog Configure Timeout", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "17": ("PLOC Supervisor: Enable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}), - "18": ("PLOC Supervisor: Disable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}), - "19": ("PLOC Supervisor: Auto calibrate alert", {OpCodeDictKeys.TIMEOUT: 2.0}), - "20": ("PLOC Supervisor: Set alert limit", {OpCodeDictKeys.TIMEOUT: 2.0}), - "21": ("PLOC Supervisor: Set alert irq filter", {OpCodeDictKeys.TIMEOUT: 2.0}), - "22": ("PLOC Supervisor: Set ADC sweep period", {OpCodeDictKeys.TIMEOUT: 2.0}), - "23": ( - "PLOC Supervisor: Set ADC enabled channels", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "24": ( - "PLOC Supervisor: Set ADC window and stride", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "25": ("PLOC Supervisor: Set ADC threshold", {OpCodeDictKeys.TIMEOUT: 2.0}), - "26": ( - "PLOC Supervisor: Request latchup status report", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "27": ("PLOC Supervisor: Copy ADC data to MRAM", {OpCodeDictKeys.TIMEOUT: 2.0}), - "28": ( - "PLOC Supervisor: Enable/Disable NVM0/1/3", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "29": ("PLOC Supervisor: Select NVM", {OpCodeDictKeys.TIMEOUT: 2.0}), - "30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}), - "31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}), - "33": ("PLOC Supervisor: Print CPU stats", {OpCodeDictKeys.TIMEOUT: 2.0}), - "34": ("PLOC Supervisor: Set debug verbosity", {OpCodeDictKeys.TIMEOUT: 2.0}), - "35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), - "36": ("PLOC Supervisor: Read GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), - "37": ("PLOC Supervisor: Restart supervisor", {OpCodeDictKeys.TIMEOUT: 2.0}), - "38": ( - "PLOC Supervisor: Factory reset clear all", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "39": ( - "PLOC Supervisor: Factory reset clear mirror entries", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "40": ( - "PLOC Supervisor: Factory reset clear circular entries", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "41": ("PLOC Supervisor: CAN loopback test", {OpCodeDictKeys.TIMEOUT: 2.0}), - } - service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv) - - op_code_dict_srv_ploc_updater = { - "0": ( - "Ploc Updater: Update uboot on partition A", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "1": ( - "Ploc Updater: Update bitstream on partition A", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "2": ( - "Ploc Updater: Update linux on partition A", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "3": ( - "Ploc Updater: Update application on partition A", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "4": ( - "Ploc Updater: Update uboot on partition B", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "5": ( - "Ploc Updater: Update bitstream on partition B", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "6": ( - "Ploc Updater: Update linux on partition B", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - "7": ( - "Ploc Updater: Update application on partition B", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - } - service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater) - op_code_dict_srv_star_tracker = { "0": ( "Star Tracker: Mode On, Submode Bootloader", @@ -488,22 +344,9 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): op_code_dict_srv_syrlinks_handler, ) service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple - service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple - service_op_code_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple - service_op_code_dict[CustomServiceList.REACTION_WHEEL_2.value] = service_rw_tuple - service_op_code_dict[CustomServiceList.REACTION_WHEEL_3.value] = service_rw_tuple - service_op_code_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple - service_op_code_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple - service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple - service_op_code_dict[ - CustomServiceList.PLOC_UPDATER.value - ] = service_ploc_updater_tuple service_op_code_dict[ CustomServiceList.STAR_TRACKER.value ] = service_star_tracker_tuple - service_op_code_dict[ - CustomServiceList.PLOC_MEMORY_DUMPER.value - ] = service_ploc_memory_dumper_tuple service_op_code_dict[ CustomServiceList.CCSDS_HANDLER.value ] = service_ccsds_handler_tuple diff --git a/pus_tc/plpcdu.py b/pus_tc/plpcdu.py index 6ee1a66..4bb44c3 100644 --- a/pus_tc/plpcdu.py +++ b/pus_tc/plpcdu.py @@ -19,6 +19,16 @@ class OpCodes: SWITCH_ADC_ON = ["0", "switch-adc-on"] SWITCH_ALL_ON = ["1", "switch-all-on"] UPDATE_DRO_TO_X8_WAIT = ["2", "dro-to-x8-wait"] + UPDATE_X8_TO_TX_WAIT_TIME = ["3", "x8-to-tx-wait"] + TX_TO_MPA_WAIT_TIME = ["4", "tx-to-mpa-wait"] + MPA_TO_HPA_WAIT_TIME = ["5", "mpa-to-hpa-wait"] + + INJECT_SSR_TO_DRO_FAILURE = ["6", "inject-ssr-dro-fault"] + INJECT_DRO_TO_X8_FAILURE = ["7", "inject-dro-x8-fault"] + INJECT_X8_TO_TX_FAILURE = ["8", "inject-x8-tx-fault"] + INJECT_TX_TO_MPA_FAILURE = ["9", "inject-tx-mpa-fault"] + INJECT_MPA_TO_HPA_FAILURE = ["10", "inject-mpa-hpa-fault"] + INJECT_ALL_ON_FAILURE = ["11", "inject-all-on-fault"] class Submodes(enum.IntEnum): @@ -84,20 +94,13 @@ 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: - wait_time = request_wait_time() - tc_queue.appendleft( - (QueueCommands.PRINT, f"Updating DRO to X8 wait time to {wait_time}") + pack_wait_time_cmd( + tc_queue=tc_queue, + param_id=ParamIds.DRO_TO_X8_WAIT_TIME, + print_str="DRO to X8", ) - if wait_time is None: - return - 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()) + if op_code in OpCodes.UPDATE_X8_TO_TX_WAIT_TIME: + pass def request_wait_time() -> Optional[float]: @@ -114,3 +117,20 @@ def request_wait_time() -> Optional[float]: LOGGER.warning("Invalid input") else: return wait_time + + +def pack_wait_time_cmd(tc_queue: TcQueueT, param_id: int, print_str: str): + wait_time = request_wait_time() + tc_queue.appendleft( + (QueueCommands.PRINT, f"Updating {print_str} wait time to {wait_time}") + ) + if wait_time is None: + return + param_data = pack_scalar_double_param_app_data( + object_id=PL_PCDU_ID, + domain_id=0, + unique_id=param_id, + parameter=wait_time, + ) + cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data) + tc_queue.appendleft(cmd.pack_command_tuple()) -- 2.43.0 From 8e0821ceaab2cd879421f068228579454037fdc5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Mar 2022 13:21:47 +0100 Subject: [PATCH 18/21] update tmtccmd and use emulated terminal --- .idea/runConfigurations/tmtcclient_CLI.xml | 2 +- config/cmd_definitions.py | 6 ++---- config/hook_implementations.py | 1 - tmtccmd | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.idea/runConfigurations/tmtcclient_CLI.xml b/.idea/runConfigurations/tmtcclient_CLI.xml index d24efcc..08531e2 100644 --- a/.idea/runConfigurations/tmtcclient_CLI.xml +++ b/.idea/runConfigurations/tmtcclient_CLI.xml @@ -15,7 +15,7 @@