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())