diff --git a/config/tmtcc_user_mode_op.py b/config/tmtcc_user_mode_op.py index b94ee97..5998a40 100644 --- a/config/tmtcc_user_mode_op.py +++ b/config/tmtcc_user_mode_op.py @@ -6,10 +6,8 @@ import sys from config.tmtcc_definitions import ModeList -from core.tmtc_backend import TmTcHandler -from test.obsw_pus_service_test import run_selected_pus_tests +from tmtc_core.core.tmtcc_backend import TmTcHandler from tmtc_core.utility.tmtcc_logger import get_logger -from utility.tmtcc_binary_uploader import BinaryFileUploader LOGGER = get_logger() diff --git a/gomspace/gomspace_common.py b/gomspace/gomspace_common.py index 7115c46..8aff120 100644 --- a/gomspace/gomspace_common.py +++ b/gomspace/gomspace_common.py @@ -96,7 +96,6 @@ def pack_ping_command(object_id: bytearray, data: bytearray) -> bytearray: data are simply copied by the device and then sent back. """ action_id = GomspaceDeviceActions.PING - command = bytearray() command = object_id + action_id + data return command @@ -107,7 +106,7 @@ def pack_gnd_wdt_reset_command(object_id: bytearray) -> bytearray: """ action_id = GomspaceDeviceActions.WDT_RESET command = bytearray() - command = object_id + action_id + command += object_id + action_id return command @@ -117,5 +116,5 @@ def pack_reboot_command(object_id: bytearray) -> bytearray: """ action_id = GomspaceDeviceActions.REBOOT command = bytearray() - command = object_id + action_id + command += object_id + action_id return command diff --git a/gomspace/gomspace_pdu_definitions.py b/gomspace/gomspace_pdu_definitions.py index 8d8b408..009eb31 100644 --- a/gomspace/gomspace_pdu_definitions.py +++ b/gomspace/gomspace_pdu_definitions.py @@ -13,4 +13,4 @@ class PDUConfigTable: class PDUHkTable: temperature = TableEntry(bytearray([0x00, 0x28]), TableEntry.uint16_size) # Ground WDT value (remaining seconds until reboot) - wdt_gnd_left = TableEntry(bytearray([0x00, 0x80]), TableEntry.uint32_size) \ No newline at end of file + wdt_gnd_left = TableEntry(bytearray([0x00, 0x80]), TableEntry.uint32_size) diff --git a/pus_tc/tmtcc_tc_acu.py b/pus_tc/tmtcc_tc_acu.py index 18e803e..e143e2a 100644 --- a/pus_tc/tmtcc_tc_acu.py +++ b/pus_tc/tmtcc_tc_acu.py @@ -8,6 +8,7 @@ from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand +from tmtc_core.core.tmtc_core_definitions import QueueCommands from gomspace.gomspace_common import * from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable from config.tmtcc_object_ids import ObjectIds @@ -53,9 +54,9 @@ class ACUHkTable: def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: - tc_queue.appendleft(("print", "Testing ACU")) + tc_queue.appendleft((QueueCommands.PRINT, "Testing ACU")) - tc_queue.appendleft(("print", "P60 Dock: Enabling ACU connected to X1 slot (channel 0)")) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Enabling ACU connected to X1 slot (channel 0)")) p60dock_object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID) command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address, P60DockConfigTable.out_en_0.parameter_size, Channel.on) @@ -63,59 +64,59 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.reboot: - tc_queue.appendleft(("print", "ACU: Reboot")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reboot")) command = pack_reboot_command(object_id) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.read_gnd_wdt: - tc_queue.appendleft(("print", "ACU: Reading ground watchdog timer value")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading ground watchdog timer value")) command = pack_get_param_command(object_id, TableIds.hk, ACUHkTable.wdt_gnd_left.parameter_address, ACUHkTable.wdt_gnd_left.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.gnd_wdt_reset: - tc_queue.appendleft(("print", "ACU: Testing ground watchdog reset")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Testing ground watchdog reset")) command = pack_gnd_wdt_reset_command(object_id) command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.ping: - tc_queue.appendleft(("print", "ACU: Ping Test")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Ping Test")) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) command = pack_ping_command(object_id, ping_data) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.read_temperature3: - tc_queue.appendleft(("print", "ACU: Reading temperature 3")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading temperature 3")) command = pack_get_param_command(object_id, TableIds.hk, ACUHkTable.temperature3.parameter_address, ACUHkTable.temperature3.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.read_vboost: - tc_queue.appendleft(("print", "ACU: Reading vboost value")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vboost value")) command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vboost.parameter_address, ACUConfigTable.vboost.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_hi: - tc_queue.appendleft(("print", "ACU: Reading vbat_max_hi")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_hi")) command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vbat_max_hi.parameter_address, ACUConfigTable.vbat_max_hi.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_lo: - tc_queue.appendleft(("print", "ACU: Reading vbat_max_lo")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_lo")) command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vbat_max_lo.parameter_address, ACUConfigTable.vbat_max_lo.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if ACUTestProcedure.all or ACUTestProcedure.read_ov_mode: - tc_queue.appendleft(("print", "ACU: Reading ov_mode")) + tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading ov_mode")) command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.ov_mode.parameter_address, ACUConfigTable.ov_mode.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.appendleft(("print", "P60 Dock: Turning off ACU")) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning off ACU")) command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address, P60DockConfigTable.out_en_0.parameter_size, Channel.off) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) diff --git a/pus_tc/tmtcc_tc_p60dock.py b/pus_tc/tmtcc_tc_p60dock.py index 3b6293e..450f177 100644 --- a/pus_tc/tmtcc_tc_p60dock.py +++ b/pus_tc/tmtcc_tc_p60dock.py @@ -5,7 +5,7 @@ @author J. Meier @date 13.12.2020 """ - +from tmtc_core.core.tmtc_core_definitions import QueueCommands from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand from gomspace.gomspace_common import * @@ -50,74 +50,86 @@ class P60DockHkTable: def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: if P60DockTestProcedure.all or P60DockTestProcedure.reboot: - tc_queue.appendleft(("print", "P60 Dock: Reboot")) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reboot")) command = pack_reboot_command(object_id) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.read_gnd_wdt: - tc_queue.appendleft(("print", "P60 Dock: Reading ground watchdog timer value")) - command = pack_get_param_command(object_id, TableIds.hk, P60DockHkTable.wdt_gnd_left.parameter_address, - P60DockHkTable.wdt_gnd_left.parameter_size) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reading ground watchdog timer value")) + command = pack_get_param_command( + object_id, TableIds.hk, P60DockHkTable.wdt_gnd_left.parameter_address, + P60DockHkTable.wdt_gnd_left.parameter_size + ) command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.gnd_wdt_reset: - tc_queue.appendleft(("print", "P60 Dock: Testing ground watchdog reset")) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing ground watchdog reset")) command = pack_gnd_wdt_reset_command(object_id) command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.ping: - tc_queue.appendleft(("print", "P60 Dock: Ping")) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Ping")) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) command = pack_ping_command(object_id, ping_data) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_off: - tc_queue.appendleft(("print", "P60 Dock: Testing setting output channel 3 off")) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 off")) parameter = 0 # set channel off command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address, P60DockConfigTable.out_en_3.parameter_size, parameter) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.read_temperature1: - tc_queue.appendleft(("print", "P60 Dock: Testing temperature reading")) - command = pack_get_param_command(object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address, - P60DockHkTable.temperature1.parameter_size) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing temperature reading")) + command = pack_get_param_command( + object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address, + P60DockHkTable.temperature1.parameter_size + ) command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on: - tc_queue.appendleft(("print", "P60 Dock: Testing Output Channel 3 state (PDU2)")) + tc_queue.appendleft((QueueCommands.PRINT, + "P60 Dock: Testing Output Channel 3 state (PDU2)")) command = pack_get_param_command(object_id, TableIds.config, P60DockConfigTable.out_en_3.parameter_address, P60DockConfigTable.out_en_3.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0: - tc_queue.appendleft(("print", "P60 Dock: Reading current limit value of output channel 0")) - command = pack_get_param_command(object_id, TableIds.config, P60DockConfigTable.cur_lu_lim_0.parameter_address, - P60DockConfigTable.cur_lu_lim_0.parameter_size) + tc_queue.appendleft((QueueCommands.PRINT, + "P60 Dock: Reading current limit value of output channel 0")) + command = pack_get_param_command( + object_id, TableIds.config, P60DockConfigTable.cur_lu_lim_0.parameter_address, + P60DockConfigTable.cur_lu_lim_0.parameter_size + ) command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on: - tc_queue.appendleft(("print", "P60 Dock: Testing setting output channel 3 on")) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 on")) parameter = 1 # set channel on command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address, P60DockConfigTable.out_en_3.parameter_size, parameter) command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.invalid_table_id_test: - tc_queue.appendleft(("print", "P60 Dock: Testing invalid table id handling")) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing invalid table id handling")) table_id_invalid = 5 - command = pack_get_param_command(object_id, table_id_invalid, P60DockHkTable.temperature1.parameter_address, - P60DockHkTable.temperature1.parameter_size) + command = pack_get_param_command( + object_id, table_id_invalid, P60DockHkTable.temperature1.parameter_address, + P60DockHkTable.temperature1.parameter_size + ) command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test: - tc_queue.appendleft(("print", "P60 Dock: Testing invalid address handling in get param command")) + tc_queue.appendleft((QueueCommands.PRINT, + "P60 Dock: Testing invalid address handling in get param command")) invalid_address = bytearray([0x01, 0xF4]) command = pack_get_param_command(object_id, TableIds.hk, invalid_address, P60DockHkTable.temperature1.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.appendleft(("print", "P60 Dock: Testing invalid address handling in set param command")) + tc_queue.appendleft((QueueCommands.PRINT, + "P60 Dock: Testing invalid address handling in set param command")) invalid_address = bytearray([0x01, 0xF4]) parameter_size = 2 parameter = 1 @@ -125,16 +137,24 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test: - tc_queue.appendleft(("print", "P60 Dock: Testing handling of invalid parameter sizes in get-param command")) + tc_queue.appendleft( + (QueueCommands.PRINT, + "P60 Dock: Testing handling of invalid parameter sizes in get-param command") + ) invalid_size = 5 - command = pack_get_param_command(object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address, - invalid_size) + command = pack_get_param_command( + object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address, invalid_size + ) command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.appendleft(("print", "P60 Dock: Testing handling of invalid parameter size in set-param command")) + tc_queue.appendleft( + (QueueCommands.PRINT, + "P60 Dock: Testing handling of invalid parameter size in set-param command") + ) parameter = 1 - command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address, invalid_size, - parameter) + command = pack_set_param_command( + object_id, P60DockConfigTable.out_en_3.parameter_address, invalid_size, parameter + ) command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) diff --git a/pus_tc/tmtcc_tc_packer_hook.py b/pus_tc/tmtcc_tc_packer_hook.py index 2fced67..86f63d6 100644 --- a/pus_tc/tmtcc_tc_packer_hook.py +++ b/pus_tc/tmtcc_tc_packer_hook.py @@ -6,13 +6,12 @@ import os from collections import deque -from typing import Union from config.tmtcc_definitions import ServiceList from tmtc_core.utility.tmtcc_logger import get_logger from tmtc_core.pus_tc.tmtcc_pus_tc_base import TcQueueT -from tmtc_core.pus_tc.tmtcc_tc_service5_event import pack_service5_test_into -from tmtc_core.pus_tc.tmtcc_tc_service17_test import pack_service17_ping_command +from tmtc_core.pus_tc.tmtcc_tc_service_5_event import pack_generic_service5_test_into +from tmtc_core.pus_tc.tmtcc_tc_service_17_test import pack_service17_ping_command from pus_tc.tmtcc_tc_p60dock import pack_p60dock_test_into from pus_tc.tmtcc_tc_pdu2 import pack_pdu2_test_into from pus_tc.tmtcc_tc_pdu1 import pack_pdu1_test_into @@ -24,9 +23,9 @@ from pus_tc.tmtcc_tc_tmp1075 import pack_tmp1075_test_into LOGGER = get_logger() -def pack_service_queue_user(service: Union[int, str], op_code: int, service_queue: TcQueueT): +def pack_service_queue_user(service: ServiceList, op_code: str, service_queue: TcQueueT): if service == ServiceList.SERVICE_5: - return pack_service5_test_into(service_queue) + return pack_generic_service5_test_into(service_queue) if service == ServiceList.SERVICE_17: return service_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple()) if service == ServiceList.P60DOCK: @@ -51,6 +50,6 @@ def create_total_tc_queue_user() -> TcQueueT: if not os.path.exists("log"): os.mkdir("log") tc_queue = deque() - pack_service5_test_into(tc_queue) + pack_generic_service5_test_into(tc_queue) tc_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple()) return tc_queue diff --git a/pus_tc/tmtcc_tc_pdu1.py b/pus_tc/tmtcc_tc_pdu1.py index 47ee8d7..da0afc4 100644 --- a/pus_tc/tmtcc_tc_pdu1.py +++ b/pus_tc/tmtcc_tc_pdu1.py @@ -8,11 +8,18 @@ from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand -from gomspace.gomspace_common import * +from tmtc_core.core.tmtcc_object_id_manager import get_object_id +from tmtc_core.core.tmtc_core_definitions import QueueCommands + from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable +from config.tmtcc_object_ids import ObjectIds +from gomspace.gomspace_common import * from gomspace.gomspace_pdu_definitions import * +P60DOCK_HANDLER_ID = get_object_id(ObjectIds.P60DOCK_HANDLER_ID) + + class PDU1TestProcedure: """ @brief Use this class to define the tests to perform for the PDU2. @@ -25,23 +32,25 @@ class PDU1TestProcedure: read_temperature = False -def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: - tc_queue.appendleft(("print", "Testing PDU1")) +def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT): + tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU1")) - tc_queue.appendleft(("print", "P60 Dock: Enabling PDU1")) - command = pack_set_param_command(g.P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_1.parameter_address, - P60DockConfigTable.out_en_1.parameter_size, Channel.on) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Enabling PDU1")) + command = pack_set_param_command( + P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_1.parameter_address, + P60DockConfigTable.out_en_1.parameter_size, Channel.on + ) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU1TestProcedure.all or PDU1TestProcedure.ping: - tc_queue.appendleft(("print", "PDU1: Ping Test")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test")) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) command = pack_ping_command(object_id, ping_data) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature: - tc_queue.appendleft(("print", "PDU1: Testing temperature reading")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading")) command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.temperature.parameter_address, PDUHkTable.temperature.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) diff --git a/pus_tc/tmtcc_tc_pdu2.py b/pus_tc/tmtcc_tc_pdu2.py index 2243bf4..1f84f9a 100644 --- a/pus_tc/tmtcc_tc_pdu2.py +++ b/pus_tc/tmtcc_tc_pdu2.py @@ -8,10 +8,15 @@ from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand +from tmtc_core.core.tmtcc_object_id_manager import get_object_id +from tmtc_core.core.tmtc_core_definitions import QueueCommands +from config.tmtcc_object_ids import ObjectIds from gomspace.gomspace_common import * from gomspace.gomspace_pdu_definitions import * from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable +P60DOCK_HANDLER_ID = get_object_id(ObjectIds.P60DOCK_HANDLER_ID) + class PDU2TestProcedure: """ @@ -26,8 +31,9 @@ class PDU2TestProcedure: ping = False channel_2_off = False # TCS Heater read_temperature = False + read_temperature1 = False read_channel_2_state = False # TCS Heater - read_cur_lu_lim_0 = False # OBC + read_cur_lu_lim_0 = False # OBC channel_2_on = False # TCS Heater invalid_table_id_test = False # Test to check if software properly handles invalid table ids invalid_address_test = False # Test to check if software properly handles invalid addresses @@ -35,62 +41,65 @@ class PDU2TestProcedure: def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: - tc_queue.appendleft(("print", "Testing PDU2")) + tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2")) - tc_queue.appendleft(("print", "P60 Dock: Enabling PDU2")) - command = pack_set_param_command(g.P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_3.parameter_address, + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Enabling PDU2")) + command = pack_set_param_command(P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_3.parameter_address, P60DockConfigTable.out_en_3.parameter_size, Channel.on) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.reboot: - tc_queue.appendleft(("print", "PDU2: Reboot")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reboot")) command = pack_reboot_command(object_id) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt: - tc_queue.appendleft(("print", "PDU2: Reading ground watchdog timer value")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value")) command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.wdt_gnd_left.parameter_address, PDUHkTable.wdt_gnd_left.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset: - tc_queue.appendleft(("print", "PDU2: Testing ground watchdog reset")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing ground watchdog reset")) command = pack_gnd_wdt_reset_command(object_id) command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.ping: - tc_queue.appendleft(("print", "PDU2: Ping Test")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Ping Test")) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) command = pack_ping_command(object_id, ping_data) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on: - tc_queue.appendleft(("print", "PDU2: Testing setting output channel 2 on (TCS Heater)")) + tc_queue.appendleft((QueueCommands.PRINT, + "PDU2: Testing setting output channel 2 on (TCS Heater)")) command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_size, Channel.on) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature1: - tc_queue.appendleft(("print", "PDU2: Testing temperature reading")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading")) command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.temperature.parameter_address, PDUHkTable.temperature.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state: - tc_queue.appendleft(("print", "PDU2: Reading output channel 2 state (TCS Heater)")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading output channel 2 state (TCS Heater)")) command = pack_get_param_command(object_id, TableIds.config, PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0: - tc_queue.appendleft(("print", "PDU2: Reading current limit value of output channel 0 (OBC)")) - command = pack_get_param_command(object_id, TableIds.config, PDUConfigTable.cur_lu_lim_0.parameter_address, + tc_queue.appendleft((QueueCommands.PRINT, + "PDU2: Reading current limit value of output channel 0 (OBC)")) + command = pack_get_param_command(object_id, TableIds.config, + PDUConfigTable.cur_lu_lim_0.parameter_address, PDUConfigTable.cur_lu_lim_0.parameter_size) command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off: - tc_queue.appendleft(("print", "PDU2: Testing setting output channel 2 off")) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off")) command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_size, Channel.off) command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command) diff --git a/pus_tc/tmtcc_tc_service200_mode.py b/pus_tc/tmtcc_tc_service200_mode.py index 2f0641a..11d81fe 100644 --- a/pus_tc/tmtcc_tc_service200_mode.py +++ b/pus_tc/tmtcc_tc_service200_mode.py @@ -5,6 +5,7 @@ @author R. Mueller @date 02.05.2020 """ +from tmtc_core.core.tmtc_core_definitions import QueueCommands from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT from tmtc_core.core.tmtcc_object_id_manager import get_object_id @@ -15,30 +16,30 @@ TEST_DEVICE_ID = get_object_id(ObjectIds.TEST_DEVICE) def pack_service200_test_into(tc_queue: TcQueueT) -> TcQueueT: - tc_queue.appendleft(("print", "Testing Service 200")) + tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200")) # Object ID: Dummy Device object_id = TEST_DEVICE_ID # Set On Mode - tc_queue.appendleft(("print", "Testing Service 200: Set Mode On")) + tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode On")) mode_data = pack_mode_data(object_id, 1, 0) command = PusTelecommand(service=200, subservice=1, ssc=2000, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) # Set Normal mode - tc_queue.appendleft(("print", "Testing Service 200: Set Mode Normal")) + tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Normal")) mode_data = pack_mode_data(object_id, 2, 0) command = PusTelecommand(service=200, subservice=1, ssc=2010, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) # Set Raw Mode - tc_queue.appendleft(("print", "Testing Service 200: Set Mode Raw")) + tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Raw")) mode_data = pack_mode_data(object_id, 3, 0) command = PusTelecommand(service=200, subservice=1, ssc=2020, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) # Set Off Mode - tc_queue.appendleft(("print", "Testing Service 200: Set Mode Off")) + tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Off")) mode_data = pack_mode_data(object_id, 0, 0) command = PusTelecommand(service=200, subservice=1, ssc=2030, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.appendleft(("export", "log/tmtc_log_service200.txt")) + tc_queue.appendleft((QueueCommands.EXPORT_LOG, "log/tmtc_log_service200.txt")) return tc_queue diff --git a/pus_tc/tmtcc_tc_tmp1075.py b/pus_tc/tmtcc_tc_tmp1075.py index 53d1c1b..6ce4131 100644 --- a/pus_tc/tmtcc_tc_tmp1075.py +++ b/pus_tc/tmtcc_tc_tmp1075.py @@ -5,7 +5,7 @@ @author J. Meier @date 06.01.2021 """ - +from tmtc_core.core.tmtc_core_definitions import QueueCommands from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand from pus_tc.tmtcc_tc_service200_mode import pack_mode_data @@ -30,28 +30,28 @@ class Tmp1075ActionIds: def pack_tmp1075_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: - tc_queue.appendleft(("print", "Testing Tmp1075 Temperature Sensor Handler")) + tc_queue.appendleft((QueueCommands.PRINT, "Testing Tmp1075 Temperature Sensor Handler")) if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion: - tc_queue.appendleft(("print", "TMP1075: Starting new temperature conversion")) + tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Starting new temperature conversion")) command = object_id + Tmp1075ActionIds.start_adc_conversion command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp: - tc_queue.appendleft(("print", "TMP1075: Read temperature")) + tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Read temperature")) command = object_id + Tmp1075ActionIds.get_temp command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if Tmp1075TestProcedure.set_mode_normal: - tc_queue.appendleft(("print", "TMP1075:: Set Mode Normal")) + tc_queue.appendleft((QueueCommands.PRINT, "TMP1075:: Set Mode Normal")) mode_data = pack_mode_data(object_id, 2, 0) command = PusTelecommand(service=200, subservice=1, ssc=220, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) if Tmp1075TestProcedure.set_mode_on: - tc_queue.appendleft(("print", "TMP1075: Set Mode On")) + tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Set Mode On")) mode_data = pack_mode_data(object_id, 1, 0) command = PusTelecommand(service=200, subservice=1, ssc=221, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) diff --git a/pus_tm/tmtcc_pus_hk_handling.py b/pus_tm/tmtcc_pus_hk_handling.py index 4128375..73eede3 100644 --- a/pus_tm/tmtcc_pus_hk_handling.py +++ b/pus_tm/tmtcc_pus_hk_handling.py @@ -6,7 +6,7 @@ """ from typing import Tuple -from tmtc_core.pus_tm.obsw_tm_service_3 import Service3Base +from tmtc_core.pus_tm.tmtcc_pus_service_3 import Service3Base from tmtc_core.utility.tmtcc_logger import get_logger LOGGER = get_logger() diff --git a/tmtc_core b/tmtc_core index e06ff9e..65a192f 160000 --- a/tmtc_core +++ b/tmtc_core @@ -1 +1 @@ -Subproject commit e06ff9ecdb43a0109ab0244a960995e233448ca6 +Subproject commit 65a192fdfc401969f142ffb2101b892137cd705e