diff --git a/config/hook_implementations.py b/config/hook_implementations.py index d7cec13..4770d89 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -90,7 +90,8 @@ 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.p60dock import P60OpCodes + from gomspace.gomspace_common import GomspaceOpCodes from pus_tc.gps import GpsOpCodes op_code_dict = { 'reboot': ('Reboot with Prompt', {OpCodeDictKeys.TIMEOUT: 2.0}), @@ -126,8 +127,12 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): op_code_dict_srv_p60 = { "0": ("P60 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), - "1": ("P60 Dock: Turn stack 3V3 on", {OpCodeDictKeys.TIMEOUT: 2.0}), - "2": ("P60 Dock: Turn stack 3V3 off", {OpCodeDictKeys.TIMEOUT: 2.0}), + P60OpCodes.STACK_3V3_ON.value: + ("P60 Dock: Turn stack 3V3 on", {OpCodeDictKeys.TIMEOUT: 2.0}), + P60OpCodes.STACK_3V3_OFF.value: + ("P60 Dock: Turn stack 3V3 off", {OpCodeDictKeys.TIMEOUT: 2.0}), + GomspaceOpCodes.PRINT_SWITCH_V_I.value: + ("P60 Dock: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_p60_tuple = ("P60 Device", op_code_dict_srv_p60) @@ -146,8 +151,8 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): ("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}), - PduOpCodes.PRINT_HK_TABLE.value: - ("PDU1: Print Info", {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) @@ -165,8 +170,8 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): ("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}) + GomspaceOpCodes.PRINT_SWITCH_V_I.value: + ("PDU1: Print Switches, Voltages, Currents", {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 5d4b0fb..934c197 100644 --- a/gomspace/gomspace_common.py +++ b/gomspace/gomspace_common.py @@ -19,11 +19,11 @@ class GomspaceDeviceActionIds(enum.IntEnum): PARAM_SET = 255 WDT_RESET = 9 REQUEST_HK_TABLE = 16 - PRINT_HK_TABLE = 32 + PRINT_SWITCH_V_I = 32 -class PduOpCodes(enum.Enum): - PRINT_HK_TABLE = "32" +class GomspaceOpCodes(enum.Enum): + PRINT_SWITCH_V_I = "32" class TableIds: diff --git a/pus_tc/p60dock.py b/pus_tc/p60dock.py index 88e6e73..14702a9 100644 --- a/pus_tc/p60dock.py +++ b/pus_tc/p60dock.py @@ -7,10 +7,15 @@ """ from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand from gomspace.gomspace_common import * +class P60OpCodes(enum.Enum): + TEST = "0" + STACK_3V3_ON = "1" + STACK_3V3_OFF = "2" + + class P60DockTestProcedure: """ @brief Use this class to define the tests to perform for the P60Dock. @@ -57,27 +62,30 @@ class P60DockHkTable: wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size) -def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: - - if op_code == "1": +def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str): + if op_code == P60OpCodes.STACK_3V3_ON.value: tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 on")) command = pack_set_param_command( object_id, P60DockConfigTable.out_en_9.parameter_address, P60DockConfigTable.out_en_9.parameter_size, Channel.on ) - # command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - return tc_queue - if op_code == "2": + return + if op_code == P60OpCodes.STACK_3V3_OFF.value: tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 off")) command = pack_set_param_command( object_id, P60DockConfigTable.out_en_9.parameter_address, P60DockConfigTable.out_en_9.parameter_size, Channel.off ) - # command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - return tc_queue - + return + if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents")) + command = generate_action_command( + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I + ) + tc_queue.appendleft(command.pack_command_tuple()) + return if P60DockTestProcedure.all or P60DockTestProcedure.reboot: tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reboot")) command = pack_reboot_command(object_id) diff --git a/pus_tc/pdu1.py b/pus_tc/pdu1.py index 7346f6e..e02bd58 100644 --- a/pus_tc/pdu1.py +++ b/pus_tc/pdu1.py @@ -91,10 +91,10 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): 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")) + if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: + tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")) command = generate_action_command( - object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_HK_TABLE + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I ) tc_queue.appendleft(command.pack_command_tuple()) diff --git a/pus_tc/pdu2.py b/pus_tc/pdu2.py index f2e4331..10a348e 100644 --- a/pus_tc/pdu2.py +++ b/pus_tc/pdu2.py @@ -84,10 +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_HK_TABLE.value: - tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Info")) + if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes")) command = generate_action_command( - object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_HK_TABLE + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I ) tc_queue.appendleft(command.pack_command_tuple())