From 4d2b7a61509a41e67cf62ecaa2864bba3acd9ef4 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sun, 25 Apr 2021 17:46:53 +0200 Subject: [PATCH] get commanded dipole service 8 hook wip --- config/object_ids.py | 2 +- pus_tc/imtq.py | 12 ++++++++++-- pus_tm/service_8_hook.py | 13 +++++++++++++ tmtccmd | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/config/object_ids.py b/config/object_ids.py index 884c78e..92f076c 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -18,7 +18,7 @@ TMP_1075_2_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x6]) HEATER_ID = bytearray([0x54, 0x00, 0x00, 0x1]) PCDU_HANDLER_ID = bytearray([0x44, 0x00, 0x10, 0x00]) SOLAR_ARRAY_DEPLOYMENT_ID = bytearray([0x44, 0x00, 0x10, 0x01]) -IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x10, 0x14]) +IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x14]) class ObjIdIds(enum.IntEnum): diff --git a/pus_tc/imtq.py b/pus_tc/imtq.py index 1692f5d..e89564f 100644 --- a/pus_tc/imtq.py +++ b/pus_tc/imtq.py @@ -8,7 +8,7 @@ from tmtccmd.core.definitions import QueueCommands from tmtccmd.pus_tc.packer import TcQueueT -from tmtccmd.pus_tc.base import PusTelecommand +from tmtccmd.ecss.tc import PusTelecommand class ImtqTestProcedure: @@ -19,10 +19,12 @@ class ImtqTestProcedure: """ all = False command_dipole = True + get_commanded_dipole = True class ImtqActionIds: start_actuation_dipole = bytearray([0x0, 0x0, 0x0, 0x02]) + get_commanded_dipole = bytearray([0x0, 0x0, 0x0, 0x03]) def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: @@ -33,7 +35,13 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: if ImtqTestProcedure.all or ImtqTestProcedure.command_dipole: tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Commanding dipole")) - command = object_id + ImtqActionIds.start_adc_conversion + command = pack_dipole_command(object_id, 1000, 1000, 1000, 10000) + command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + if ImtqTestProcedure.all or ImtqTestProcedure.get_commanded_dipole: + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Get commanded dipole")) + command = object_id + ImtqActionIds.get_commanded_dipole command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) diff --git a/pus_tm/service_8_hook.py b/pus_tm/service_8_hook.py index 12a8617..7adfe62 100644 --- a/pus_tm/service_8_hook.py +++ b/pus_tm/service_8_hook.py @@ -1,5 +1,6 @@ from typing import Tuple from config.object_ids import ObjIdIds +from pus_tc.imtq import ImtqActionIds def user_analyze_service_8_data( @@ -25,7 +26,19 @@ def user_analyze_service_8_data( data_string = data_string.rstrip(',') data_string = data_string.rstrip() content_list = [data_string] + elif object_id == ObjIdIds.IMTQ_HANDLER_ID: + return handle_imtq_replies(action_id, custom_data) else: header_list = [] content_list = [] return header_list, content_list + + +def handle_imtq_replies(action_id: int, custom_data: bytearray) -> Tuple[list, list]: + header_list = [] + content_list = [] + if action_id == ImtqActionIds.get_commanded_dipole: + header_list = ['Commanded X-Dipole', 'Commanded Y-Dipole', 'Commanded Z-Dipole'] + x_dipole = + content_list = [custom_data[:4], custom_data[4:6], custom_data[6:10]] + return header_list, content_list diff --git a/tmtccmd b/tmtccmd index 563603d..1773f62 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 563603d0a1b03115e473768ccd203a21ebaac50c +Subproject commit 1773f62856f6c430c380f4c256d54a7a0b8f0a75