From e7d735966af6a9e5d70dbf5771a65ed98c2052e1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 4 Feb 2022 17:05:27 +0100 Subject: [PATCH] add commands to switch on/off scex --- config/cmd_definitions.py | 140 ++++++++++++++++++++++---------------- pus_tc/pdu1.py | 21 ++++++ 2 files changed, 104 insertions(+), 57 deletions(-) diff --git a/config/cmd_definitions.py b/config/cmd_definitions.py index 7ffac58..589e581 100644 --- a/config/cmd_definitions.py +++ b/config/cmd_definitions.py @@ -91,63 +91,89 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): op_code_entry=op_code_dict, ) - op_code_dict_srv_pdu1 = { - "0": ("PDU1 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), - Pdu1OpCodes.TCS_BOARD_ON.value: ( - "PDU1: Turn TCS board on", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.TCS_BOARD_OFF.value: ( - "PDU1: Turn TCS board off", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.STAR_TRACKER_ON.value: ( - "PDU1: Turn star tracker on", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.STAR_TRACKER_OFF.value: ( - "PDU1: Turn star tracker off", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.SUS_NOMINAL_ON.value: ( - "PDU1: Turn SUS nominal on", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.SUS_NOMINAL_OFF.value: ( - "PDU1: Turn SUS nominal off", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.ACS_A_SIDE_ON.value: ( - "PDU1: Turn ACS Side A on", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.ACS_A_SIDE_OFF.value: ( - "PDU1: Turn ACS Side A off", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.SYRLINKS_ON.value: ( - "PDU1: Turn Syrlinks on", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.SYRLINKS_OFF.value: ( - "PDU1: Turn Syrlinks off", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.MGT_ON.value: ( - "PDU1: Turn MGT on", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - Pdu1OpCodes.MGT_OFF.value: ( - "PDU1: Turn MGT off", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - GomspaceOpCodes.PRINT_SWITCH_V_I.value: ( - "PDU1: Print Switches, Voltages, Currents", - {OpCodeDictKeys.TIMEOUT: 2.0}, - ), - } - service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1) - cmd_dict[CustomServiceList.PDU1.value] = service_pdu1_tuple + op_code_dict = dict() + add_op_code_entry(op_code_dict=op_code_dict, keys="0", info="PDU1 Tests") + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.TCS_BOARD_ON.value, + info="PDU1: Turn TCS board on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.TCS_BOARD_OFF.value, + info="PDU1: Turn TCS board off", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.STAR_TRACKER_ON.value, + info="PDU1: Turn star tracker on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.STAR_TRACKER_OFF.value, + info="PDU1: Turn star tracker off", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.SUS_NOMINAL_ON.value, + info="PDU1: Turn SUS nominal on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.SUS_NOMINAL_OFF.value, + info="PDU1: Turn SUS nominal off", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.ACS_A_SIDE_ON.value, + info="PDU1: Turn ACS A side on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.ACS_A_SIDE_OFF.value, + info="PDU1: Turn ACS A side off", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.SYRLINKS_ON.value, + info="PDU1: Turn Syrlinks on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.SYRLINKS_OFF.value, + info="PDU1: Turn Syrlinks off", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.MGT_ON.value, + info="PDU1: Turn MGT on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.MGT_OFF.value, + info="PDU1: Turn MGT on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.SCEX_ON.value, + info="PDU1: Turn Solar Cell Experiment on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.SCEX_OFF.value, + info="PDU1: Turn Solar Cell Experiment off", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value, + info="PDU1: Print Switches, Voltages, Currents", + ) + add_service_op_code_entry( + srv_op_code_dict=cmd_dict, + name=CustomServiceList.PDU1.value, + info="PDU1 Device", + op_code_entry=op_code_dict, + ) op_code_dict = dict() add_op_code_entry( diff --git a/pus_tc/pdu1.py b/pus_tc/pdu1.py index a7bd943..95419f6 100644 --- a/pus_tc/pdu1.py +++ b/pus_tc/pdu1.py @@ -27,6 +27,9 @@ class Pdu1OpCodes(enum.Enum): SYRLINKS_OFF = "10" MGT_ON = "11" MGT_OFF = "12" + # Solar Cell Experiment + SCEX_ON = "13" + SCEX_OFF = "14" class PDU1TestProcedure: @@ -130,6 +133,24 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): Channel.off, ) 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")) + command = pack_set_param_command( + object_id, + PDUConfigTable.out_en_5.parameter_address, + PDUConfigTable.out_en_5.parameter_size, + Channel.on, + ) + 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")) + command = pack_set_param_command( + object_id, + PDUConfigTable.out_en_5.parameter_address, + PDUConfigTable.out_en_5.parameter_size, + Channel.off, + ) + tc_queue.appendleft(command.pack_command_tuple()) if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: tc_queue.appendleft( (QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")