From b8d666a18382bd61067f5d9667f77c78fb2c1ed1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 25 Feb 2022 19:21:32 +0100 Subject: [PATCH] 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