From 6da94c73d0568c64e41d6c4b803539e09409c942 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 14:51:24 +0200 Subject: [PATCH 1/7] more print commands for PCDU --- config/hook_implementations.py | 7 +++++-- gomspace/gomspace_common.py | 12 ++++++++++- pus_tc/pdu2.py | 38 +++++++++++++++++++++++++++------- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/config/hook_implementations.py b/config/hook_implementations.py index e06d561..43664e9 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -90,6 +90,7 @@ class EiveHookObject(TmTcHookBase): def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): from pus_tc.pdu1 import Pdu1OpCodes from pus_tc.pdu2 import Pdu2OpCodes + from gomspace.gomspace_common import PduOpCodes from pus_tc.gps import GpsOpCodes op_code_dict = { 'reboot': ('Reboot with Prompt', {OpCodeDictKeys.TIMEOUT: 2.0}), @@ -156,8 +157,10 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): "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}), - Pdu1OpCodes.PRINT_SWITCH_STATE.value: - ("PDU1: Print switch states", {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}) } service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2) diff --git a/gomspace/gomspace_common.py b/gomspace/gomspace_common.py index 534c5a9..6b9cb65 100644 --- a/gomspace/gomspace_common.py +++ b/gomspace/gomspace_common.py @@ -19,7 +19,17 @@ class GomspaceDeviceActionIds(enum.IntEnum): PARAM_SET = 255 WDT_RESET = 9 REQUEST_HK_TABLE = 16 - PRINT_SWITCH_STATE = 17 + PRINT_ALL = 32 + PRINT_SWITCH_STATES = 33 + PRINT_CURRENTS = 34 + PRINT_VOLTAGES = 35 + + +class PduOpCodes(enum.Enum): + PRINT_ALL = "32" + PRINT_SWITCH_STATES = "33" + PRINT_CURRENTS = "34" + PRINT_VOLTAGES = "35" class TableIds: diff --git a/pus_tc/pdu2.py b/pus_tc/pdu2.py index 32786fb..325585b 100644 --- a/pus_tc/pdu2.py +++ b/pus_tc/pdu2.py @@ -15,7 +15,10 @@ from gomspace.gomspace_pdu_definitions import * class Pdu2OpCodes(enum.Enum): ACS_SIDE_B_ON = "1" ACS_SIDE_B_OFF = "2" - PRINT_SWITCH_STATE = "17" + SUS_REDUNDANT_ON = "3" + SUS_REDUNDANT_OFF = "4" + RW_ON = "5" + RW_OFF = "6" class PDU2TestProcedure: @@ -59,31 +62,50 @@ def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) ) tc_queue.appendleft(command.pack_command_tuple()) return tc_queue - if op_code == "3": + if op_code == Pdu2OpCodes.SUS_REDUNDANT_ON.value: tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant 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 == "4": + if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value: tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant 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 == "5": + if op_code == Pdu2OpCodes.RW_ON.value: tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels on")) command = pack_set_param_command( - object_id, PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_size, Channel.on + object_id, PDUConfigTable.out_en_2.parameter_address, + PDUConfigTable.out_en_2.parameter_size, Channel.on ) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "6": + if op_code == Pdu2OpCodes.RW_OFF.value: tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels off")) 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 == Pdu2OpCodes.PRINT_SWITCH_STATE.value: + if op_code == PduOpCodes.PRINT_ALL.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_STATE + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_STATES + ) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == PduOpCodes.PRINT_CURRENTS: + 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: + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Voltages")) + command = generate_action_command( + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_VOLTAGES ) tc_queue.appendleft(command.pack_command_tuple()) -- 2.43.0 From 5c65390a8b0344c41728d276729cae0a2cc1d9d1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 15:00:16 +0200 Subject: [PATCH 2/7] fix for new commands --- pus_tc/pdu2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pus_tc/pdu2.py b/pus_tc/pdu2.py index 325585b..ad2b90a 100644 --- a/pus_tc/pdu2.py +++ b/pus_tc/pdu2.py @@ -96,13 +96,13 @@ def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_STATES ) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == PduOpCodes.PRINT_CURRENTS: + 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: + 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 -- 2.43.0 From a5d9fedc649966c901a7ede9bbbe915df9ed9446 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 17:24:50 +0200 Subject: [PATCH 3/7] bugfix --- .idea/runConfigurations/P60_Dock_Commanding.xml | 2 +- pus_tc/pdu1.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/runConfigurations/P60_Dock_Commanding.xml b/.idea/runConfigurations/P60_Dock_Commanding.xml index 0b80151..b4e4fcd 100644 --- a/.idea/runConfigurations/P60_Dock_Commanding.xml +++ b/.idea/runConfigurations/P60_Dock_Commanding.xml @@ -1,5 +1,5 @@ - +