From 88f319bed4bdeb07e2803da93d1fb5ac4e0a59da Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 27 May 2022 14:29:56 +0200 Subject: [PATCH] syrlinks HK procedure --- pus_tc/devs/star_tracker.py | 6 +++++- pus_tc/devs/syrlinks_hk_handler.py | 10 ++++++---- pus_tc/system/proc.py | 30 ++++++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/pus_tc/devs/star_tracker.py b/pus_tc/devs/star_tracker.py index d8c9a94..bbe3c2c 100644 --- a/pus_tc/devs/star_tracker.py +++ b/pus_tc/devs/star_tracker.py @@ -85,6 +85,10 @@ class StarTrackerActionIds: FIRMWARE_UPDATE = 84 +class OpCodes: + NORMAL = ["2", "nml"] + + class SetIds: TEMPERATURE = 25 @@ -172,7 +176,7 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code command = pack_mode_data(object_id, Modes.ON, Submode.FIRMWARE) command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "2": + if op_code in OpCodes.NORMAL: tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Normal")) command = pack_mode_data(object_id, Modes.NORMAL, 0) command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command) diff --git a/pus_tc/devs/syrlinks_hk_handler.py b/pus_tc/devs/syrlinks_hk_handler.py index 48adbcd..6937bd6 100644 --- a/pus_tc/devs/syrlinks_hk_handler.py +++ b/pus_tc/devs/syrlinks_hk_handler.py @@ -19,6 +19,10 @@ class SetIds: TX_REGISTERS_DATASET = 2 +class OpCodes: + NORMAL = ["2", "nml"] + + class CommandIds: READ_RX_STATUS_REGISTERS = 2 SET_TX_MODE_STANDBY = 3 @@ -37,9 +41,7 @@ class CommandIds: DISABLE_DEBUG = 21 -def pack_syrlinks_command( - object_id: bytearray, tc_queue: TcQueueT, op_code: str -) -> TcQueueT: +def pack_syrlinks_command(object_id: bytearray, tc_queue: TcQueueT, op_code: str): tc_queue.appendleft( ( QueueCommands.PRINT, @@ -57,7 +59,7 @@ def pack_syrlinks_command( command = pack_mode_data(object_id, Modes.ON, 0) command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "2": + if op_code in OpCodes.NORMAL: tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Mode Normal")) command = pack_mode_data(object_id, Modes.NORMAL, 0) command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index 7c6a4b6..64df168 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -30,6 +30,9 @@ from pus_tc.devs.mgms import MgmLis3SetIds as MgmLis3SetIds_0_2 from pus_tc.devs.mgms import MgmRm3100SetIds as MgmRm3100SetIds_1_3 from pus_tc.devs.gyros import AdisGyroSetIds as AdisGyroSetIds_0_2 from pus_tc.devs.gyros import L3gGyroSetIds as L3gGyroSetIds_1_3 +from pus_tc.devs.syrlinks_hk_handler import OpCodes as SyrlinksOpCodes +from pus_tc.devs.syrlinks_hk_handler import SetIds as SyrlinksSetIds +from pus_tc.devs.star_tracker import OpCodes as StrOpCodes from pus_tc.devs.gps import SetIds as GpsSetIds from pus_tc.devs.imtq import ImtqSetIds from pus_tc.devs.sus import SetIds @@ -57,6 +60,7 @@ class OpCodes: STR_FT = ["str-ft"] RW_FT_ONE_RW = ["rw-ft-one-rw"] RW_FT_TWO_RWS = ["rw-ft-two-rws"] + SYRLINKS_FT = ["syrlinks-ft"] TV_TEARDOWN_TCS_FT_OFF = ["teardown", "tcs-ft-off"] @@ -67,6 +71,7 @@ class KeyAndInfo: BAT_FT = ["BPX Battery", "battery functional test"] CORE_FT = ["OBC", "OBC functional test"] PCDU_FT = ["PCDU", "PCDU functional test"] + SYRLINKS_FT = ["Syrlinks", "Syrlinks functional test"] RAD_SEN_FT = ["Radiation Sensor", "Radiation Sensor functional test"] ACS_FT = ["ACS", "ACS functional test"] MGT_FT = ["MGT", "MGT functional test"] @@ -85,7 +90,12 @@ PROC_INFO_DICT = { KAI.CORE_FT[0]: [OpCodes.CORE_FT, KAI.CORE_FT[1], 120.0, 10.0], KAI.PCDU_FT[0]: [OpCodes.PCDU_FT, KAI.PCDU_FT[1], 120.0, 10.0], KAI.RAD_SEN_FT[0]: [OpCodes.RAD_SEN_FT, KAI.RAD_SEN_FT[1], 120.0, 10.0], - KAI.TCS_FT_ON[0]: [OpCodes.TV_SETUP_TCS_FT_ON, KAI.TCS_FT_ON[1], 120.0, 10.0], + KAI.TV_SETUP_TCS_FT_ON[0]: [ + OpCodes.TV_SETUP_TCS_FT_ON, + KAI.TV_SETUP_TCS_FT_ON[1], + 120.0, + 10.0, + ], KAI.TV_TEARDOWN_TCS_FT_OFF[0]: [ OpCodes.TV_TEARDOWN_TCS_FT_OFF, KAI.TV_TEARDOWN_TCS_FT_OFF[1], @@ -474,11 +484,27 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_acs_command(tc_queue=tc_queue, op_code="sus-off") + if op_code in OpCodes.SYRLINKS_FT: + key = KAI.SYRLINKS_FT[0] + sid_list = [ + make_sid(oids.SYRLINKS_HANDLER_ID, SyrlinksSetIds.RX_REGISTERS_DATASET), + make_sid(oids.SYRLINKS_HANDLER_ID, SyrlinksSetIds.TX_REGISTERS_DATASET), + ] + # HK listening + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, + proc_key=key, + sid_list=sid_list, + diag=False, + cfg=GenericHkListeningCfg.default(), + ) if op_code in OpCodes.STR_FT: key = KAI.STR_FT[0] pack_star_tracker_commands( - object_id=oids.STAR_TRACKER_ID, tc_queue=tc_queue, op_code="2" + object_id=oids.STAR_TRACKER_ID, + tc_queue=tc_queue, + op_code=StrOpCodes.NORMAL[0], ) # STR -- 2.43.0