From f3a2e755fdc73ee791ea32dc6f2dfce43af70e60 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 Sep 2021 11:21:53 +0200 Subject: [PATCH] cleaned up PDU1 print commands --- config/hook_implementations.py | 34 ++++++++++++++++++++-------------- gomspace/gomspace_common.py | 10 ++-------- pus_tc/pdu1.py | 17 ++++++++--------- pus_tc/pdu2.py | 22 ++-------------------- 4 files changed, 32 insertions(+), 51 deletions(-) diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 9125461..d7cec13 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -136,31 +136,37 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): Pdu1OpCodes.STAR_TRACKER_ON.value: ("PDU1: Turn star tracker on", {OpCodeDictKeys.TIMEOUT: 2.0}), "2": ("PDU1: Get switch state of star tracker", {OpCodeDictKeys.TIMEOUT: 2.0}), - "3": ("PDU1: Turn SUS nominal on", {OpCodeDictKeys.TIMEOUT: 2.0}), + Pdu1OpCodes.SUS_NOMINAL_ON.value: + ("PDU1: Turn SUS nominal on", {OpCodeDictKeys.TIMEOUT: 2.0}), Pdu1OpCodes.STAR_TRACKER_OFF.value: ("PDU1: Turn star tracker off", {OpCodeDictKeys.TIMEOUT: 2.0}), - "5": ("PDU1: Turn SUS nominal off", {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.PRINT_SWITCH_STATE.value: - ("PDU1: Print switch states", {OpCodeDictKeys.TIMEOUT: 2.0}) + PduOpCodes.PRINT_HK_TABLE.value: + ("PDU1: Print Info", {OpCodeDictKeys.TIMEOUT: 2.0}) } service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1) op_code_dict_srv_pdu2 = { "0": ("PDU2 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), - "1": ("PDU2: Turn ACS Side B on", {OpCodeDictKeys.TIMEOUT: 2.0}), - "2": ("PDU2: Turn ACS Side B off", {OpCodeDictKeys.TIMEOUT: 2.0}), - "3": ("PDU2: Turn SUS redundant on", {OpCodeDictKeys.TIMEOUT: 2.0}), - "4": ("PDU2: Turn SUS redundant off", {OpCodeDictKeys.TIMEOUT: 2.0}), - "5": ("PDU2: Turn reaction wheels on", {OpCodeDictKeys.TIMEOUT: 2.0}), - "6": ("PDU2: Turn reaction wheels off", {OpCodeDictKeys.TIMEOUT: 2.0}), - PduOpCodes.PRINT_ALL.value: ("PDU2: Print Info", {OpCodeDictKeys.TIMEOUT: 2.0}), - PduOpCodes.PRINT_SWITCH_STATES.value: ("PDU2: Print Switch States", {OpCodeDictKeys.TIMEOUT: 2.0}), - PduOpCodes.PRINT_CURRENTS.value: ("PDU2: Print Currents", {OpCodeDictKeys.TIMEOUT: 2.0}), - PduOpCodes.PRINT_VOLTAGES.value: ("PDU2: Print Voltages", {OpCodeDictKeys.TIMEOUT: 2.0}) + Pdu2OpCodes.ACS_SIDE_B_ON.value: + ("PDU2: Turn ACS Side B on", {OpCodeDictKeys.TIMEOUT: 2.0}), + Pdu2OpCodes.ACS_SIDE_B_OFF.value: + ("PDU2: Turn ACS Side B off", {OpCodeDictKeys.TIMEOUT: 2.0}), + Pdu2OpCodes.SUS_REDUNDANT_ON.value: + ("PDU2: Turn SUS redundant on", {OpCodeDictKeys.TIMEOUT: 2.0}), + Pdu2OpCodes.SUS_REDUNDANT_OFF.value: + ("PDU2: Turn SUS redundant off", {OpCodeDictKeys.TIMEOUT: 2.0}), + Pdu2OpCodes.RW_ON.value: + ("PDU2: Turn reaction wheels on", {OpCodeDictKeys.TIMEOUT: 2.0}), + Pdu2OpCodes.RW_OFF.value: + ("PDU2: Turn reaction wheels off", {OpCodeDictKeys.TIMEOUT: 2.0}), + PduOpCodes.PRINT_HK_TABLE.value: + ("PDU1: Print Info", {OpCodeDictKeys.TIMEOUT: 2.0}) } service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2) diff --git a/gomspace/gomspace_common.py b/gomspace/gomspace_common.py index 6b9cb65..5d4b0fb 100644 --- a/gomspace/gomspace_common.py +++ b/gomspace/gomspace_common.py @@ -19,17 +19,11 @@ class GomspaceDeviceActionIds(enum.IntEnum): PARAM_SET = 255 WDT_RESET = 9 REQUEST_HK_TABLE = 16 - PRINT_ALL = 32 - PRINT_SWITCH_STATES = 33 - PRINT_CURRENTS = 34 - PRINT_VOLTAGES = 35 + PRINT_HK_TABLE = 32 class PduOpCodes(enum.Enum): - PRINT_ALL = "32" - PRINT_SWITCH_STATES = "33" - PRINT_CURRENTS = "34" - PRINT_VOLTAGES = "35" + PRINT_HK_TABLE = "32" class TableIds: diff --git a/pus_tc/pdu1.py b/pus_tc/pdu1.py index 0d0f4b2..7346f6e 100644 --- a/pus_tc/pdu1.py +++ b/pus_tc/pdu1.py @@ -20,7 +20,6 @@ class Pdu1OpCodes(enum.Enum): SUS_NOMINAL_OFF = "5" ACS_A_SIDE_ON = "6" ACS_A_SIDE_OFF = "7" - PRINT_SWITCH_STATE = "17" class PDU1TestProcedure: @@ -78,26 +77,26 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): PDUConfigTable.out_en_7.parameter_size, Channel.off ) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == Pdu1OpCodes.PRINT_SWITCH_STATE.value: - tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Switch Status")) - command = generate_action_command( - object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_STATES - ) - tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "8": + if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value: tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal on")) command = pack_set_param_command( object_id, PDUConfigTable.out_en_4.parameter_address, PDUConfigTable.out_en_4.parameter_size, Channel.on ) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "9": + if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value: tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off")) command = pack_set_param_command( object_id, PDUConfigTable.out_en_4.parameter_address, PDUConfigTable.out_en_4.parameter_size, Channel.off ) tc_queue.appendleft(command.pack_command_tuple()) + if op_code == PduOpCodes.PRINT_HK_TABLE.value: + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Info")) + command = generate_action_command( + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_HK_TABLE + ) + tc_queue.appendleft(command.pack_command_tuple()) if PDU1TestProcedure.all or PDU1TestProcedure.ping: tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test")) diff --git a/pus_tc/pdu2.py b/pus_tc/pdu2.py index 25a4a7a..f2e4331 100644 --- a/pus_tc/pdu2.py +++ b/pus_tc/pdu2.py @@ -84,28 +84,10 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) - command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_size, Channel.off) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == PduOpCodes.PRINT_ALL.value: + if op_code == PduOpCodes.PRINT_HK_TABLE.value: tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Info")) command = generate_action_command( - object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_ALL - ) - tc_queue.appendleft(command.pack_command_tuple()) - if op_code == PduOpCodes.PRINT_SWITCH_STATES.value: - tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Switch Status")) - command = generate_action_command( - object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_STATES - ) - tc_queue.appendleft(command.pack_command_tuple()) - if op_code == PduOpCodes.PRINT_CURRENTS.value: - tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Currents")) - command = generate_action_command( - object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_CURRENTS - ) - tc_queue.appendleft(command.pack_command_tuple()) - if op_code == PduOpCodes.PRINT_VOLTAGES.value: - tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Voltages")) - command = generate_action_command( - object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_VOLTAGES + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_HK_TABLE ) tc_queue.appendleft(command.pack_command_tuple())