diff --git a/pus_tc/devs/imtq.py b/pus_tc/devs/imtq.py index f71de6b..ea31b5d 100644 --- a/pus_tc/devs/imtq.py +++ b/pus_tc/devs/imtq.py @@ -5,6 +5,8 @@ @author J. Meier @date 25.03.2021 """ +import struct + from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT @@ -276,11 +278,10 @@ def pack_dipole_command( command is sent. """ action_id = ImtqActionIds.start_actuation_dipole - command = bytearray() command = object_id + action_id - command.extend(x_dipole.to_bytes(length=2, byteorder="big")) - command.extend(y_dipole.to_bytes(length=2, byteorder="big")) - command.extend(z_dipole.to_bytes(length=2, byteorder="big")) - command.extend(duration.to_bytes(length=2, byteorder="big")) + command += struct.pack('!h', x_dipole) + command += struct.pack('!h', y_dipole) + command += struct.pack('!h', z_dipole) + command += struct.pack('!h', duration) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) return command diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index f524193..99935d8 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -210,7 +210,7 @@ def pack_generic_hk_listening_cmds( ) if not cfg.use_tc_sched: - tc_queue.appendleft((QueueCommands.WAIT, 120)) + tc_queue.appendleft((QueueCommands.WAIT, 60)) sid_list.clear() diag_list.clear() @@ -332,7 +332,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): False, True, False, - False + True ] pack_acs_command(tc_queue=tc_queue, op_code="acs-a") @@ -358,7 +358,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): False, True, False, - False + True ] for b_side_dev in b_side_pairs: @@ -393,7 +393,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): False, True, False, - False, + True, ] pack_generic_hk_listening_cmds( tc_queue=tc_queue, @@ -413,12 +413,15 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): (oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET), ] diag_list = [ - False, - False, - False, + True, + True, + True, ] - # mgt 1: imtq und hk + # Command MGT to mode on + pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="1") + tc_queue.appendleft((QueueCommands.WAIT, 5)) + # Command MGT to normal mode pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="2") for imtq_dev in imtq_pairs: @@ -456,23 +459,24 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): diag_list = [ False, False, + True, + False, + True, False, False, + Truehk, False, - False, - False, - False, - False, - False, - False, - False, - False, + True, + True, + True, + True, ] pack_acs_command(tc_queue=tc_queue, op_code="acs-d") - # mgt 2.: imtq + dual side + dipole - pack_imtq_test_into( - object_id=oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="2" - ) + # Command MGT to mode on + pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="1") + tc_queue.appendleft((QueueCommands.WAIT, 20)) + # Command MGT to normal mode + pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="2") for d_side_and_imtq_dev in d_side_and_imtq_pairs: oid = d_side_and_imtq_dev[0] diff --git a/pus_tm/devs/gyros.py b/pus_tm/devs/gyros.py index ff56abf..8031143 100644 --- a/pus_tm/devs/gyros.py +++ b/pus_tm/devs/gyros.py @@ -60,7 +60,7 @@ def handle_adis_gyro_hk( def handle_l3g_gyro_hk( object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes ): - if set_id == L3gGyroSetIds: + if set_id == L3gGyroSetIds.CORE_HK: pw = PrintWrapper(printer) fmt_str = "!ffff" inc_len = struct.calcsize(fmt_str) diff --git a/pus_tm/devs/mgms.py b/pus_tm/devs/mgms.py index 0a9db2c..1683c29 100644 --- a/pus_tm/devs/mgms.py +++ b/pus_tm/devs/mgms.py @@ -10,8 +10,10 @@ import config.object_ids as obj_ids def handle_mgm_hk_data( object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes ): - if object_id in [obj_ids.MGM_0_LIS3_HANDLER_ID, obj_ids.MGM_2_LIS3_HANDLER_ID]: + if object_id.as_bytes in [obj_ids.MGM_0_LIS3_HANDLER_ID, obj_ids.MGM_2_LIS3_HANDLER_ID]: handle_mgm_lis3_hk_data(object_id, printer, set_id, hk_data) + elif object_id.as_bytes in [obj_ids.MGM_1_RM3100_HANDLER_ID, obj_ids.MGM_3_RM3100_HANDLER_ID]: + handle_mgm_rm3100_hk_data(object_id, printer, set_id, hk_data) pass @@ -23,7 +25,7 @@ def handle_mgm_lis3_hk_data( fmt_str = "!ffff" inc_len = struct.calcsize(fmt_str) (field_x, field_y, field_z, temp) = struct.unpack( - fmt_str, hk_data[0 : 0 + inc_len] + fmt_str, hk_data[0: 0 + inc_len] ) pw.dlog(f"Received MGM LIS3 from object {object_id}") pw.dlog(