From 3f29dff6067e8c6a486deda93f071b705b7dc699 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 17 Sep 2021 13:06:53 +0200 Subject: [PATCH] added stubs for new commands --- pus_tc/acs.py | 23 +++++++++++++++-------- pus_tc/pdu1.py | 19 ++++++++++--------- pus_tc/pdu2.py | 2 +- pus_tc/tc_packer_hook.py | 8 ++++---- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/pus_tc/acs.py b/pus_tc/acs.py index abe1431..66f5ad6 100644 --- a/pus_tc/acs.py +++ b/pus_tc/acs.py @@ -4,22 +4,29 @@ from tmtccmd.pus.service_list import PusServices from tmtccmd.tc.service_200_mode import pack_mode_data, Modes from tmtccmd.tc.packer import PusTelecommand from config.object_ids import MGM_0_HANDLER_ID, MGM_1_HANDLER_ID, MGM_2_HANDLER_ID, MGM_3_HANDLER_ID +from pus_tc.pdu1 import pack_pdu1_commands, Pdu1OpCodes +from pus_tc.pdu2 import pack_pdu2_commands, Pdu2OpCodes class AcsOpCodes(enum.Enum): + ALL_ON = "0" + ALL_OFF = "1" + POWER_CYCLE = "2" # Switch on A side - ON_MGM_0 = "0" - ON_MGM_1 = "1" - ON_GYRO_0 = "2" - ON_GYRO_1 = "3" + ON_MGM_0 = "12" + ON_MGM_1 = "13" + ON_GYRO_0 = "14" + ON_GYRO_1 = "15" # Switch on B side - ON_MGM_2 = "4" - ON_MGM_3 = "5" - ON_GYRO_2 = "6" - ON_GYRO_3 = "7" + ON_MGM_2 = "16" + ON_MGM_3 = "17" + ON_GYRO_2 = "18" + ON_GYRO_3 = "19" def pack_acs_command(tc_queue: TcQueueT, op_code: str): + if op_code == AcsOpCodes.ALL_ON: + pass if op_code == AcsOpCodes.ON_MGM_0.value: app_data = pack_mode_data(object_id=MGM_0_HANDLER_ID, mode=Modes.ON, submode=0) # return PusTelecommand(service=PusServices.SERVICE_200_MODE, subservice=) \ No newline at end of file diff --git a/pus_tc/pdu1.py b/pus_tc/pdu1.py index f52579c..0d0f4b2 100644 --- a/pus_tc/pdu1.py +++ b/pus_tc/pdu1.py @@ -1,8 +1,5 @@ # -*- coding: utf-8 -*- -""" -@file tmtcc_tc_pdu1.py -@brief PDU2 tests -@details PDU2 is mounted on the X4 slot of the P60 dock +"""PDU2 is mounted on the X4 slot of the P60 dock @author J. Meier @date 17.12.2020 """ @@ -18,7 +15,9 @@ from gomspace.gomspace_pdu_definitions import * class Pdu1OpCodes(enum.Enum): STAR_TRACKER_ON = "1" + SUS_NOMINAL_ON = "3" STAR_TRACKER_OFF = "4" + SUS_NOMINAL_OFF = "5" ACS_A_SIDE_ON = "6" ACS_A_SIDE_OFF = "7" PRINT_SWITCH_STATE = "17" @@ -40,7 +39,7 @@ class PDU1TestProcedure: turn_channel_3_off = False -def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str): +def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): tc_queue.appendleft((QueueCommands.PRINT, "Commanding PDU1")) if op_code == Pdu1OpCodes.STAR_TRACKER_ON.value: @@ -48,7 +47,7 @@ def pack_pdu1_test_into(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.on) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "3": + 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) @@ -58,10 +57,12 @@ def pack_pdu1_test_into(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 == "5": + 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) + 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 == Pdu1OpCodes.ACS_A_SIDE_ON.value: tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A on")) diff --git a/pus_tc/pdu2.py b/pus_tc/pdu2.py index ad2b90a..25a4a7a 100644 --- a/pus_tc/pdu2.py +++ b/pus_tc/pdu2.py @@ -43,7 +43,7 @@ class PDU2TestProcedure: request_hk_table = False -def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: +def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2")) if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value: diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 5e093e3..4eef894 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -12,8 +12,8 @@ from tmtccmd.tc.service_17_test import pack_service17_ping_command from pus_tc.service_200_mode import pack_service200_test_into from pus_tc.p60dock import pack_p60dock_test_into -from pus_tc.pdu2 import pack_pdu2_test_into -from pus_tc.pdu1 import pack_pdu1_test_into +from pus_tc.pdu2 import pack_pdu2_commands +from pus_tc.pdu1 import pack_pdu1_commands from pus_tc.acu import pack_acu_test_into from pus_tc.imtq import pack_imtq_test_into from pus_tc.tmp1075 import pack_tmp1075_test_into @@ -50,10 +50,10 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) if service == CustomServiceList.PDU1.value: object_id = PDU_1_HANDLER_ID - return pack_pdu1_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) + return pack_pdu1_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code) if service == CustomServiceList.PDU2.value: object_id = PDU_2_HANDLER_ID - return pack_pdu2_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) + return pack_pdu2_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code) if service == CustomServiceList.ACU.value: object_id = ACU_HANDLER_ID return pack_acu_test_into(object_id=object_id, tc_queue=service_queue)