From e4eed4602d2fde1d66d564b0616048b230cc94b5 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Tue, 15 Jun 2021 15:23:27 +0200 Subject: [PATCH] imtq tests --- config/hook_implementations.py | 7 ++ pus_tc/imtq.py | 128 +++++++++++++++++++++++++----- pus_tm/factory_hook.py | 4 +- pus_tm/hk_handling.py | 140 +++++++++++++++++++++++++++++++-- pus_tm/hk_handling_hook.py | 112 -------------------------- tmtccmd | 2 +- 6 files changed, 251 insertions(+), 142 deletions(-) delete mode 100644 pus_tm/hk_handling_hook.py diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 124cedd..e55836f 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -53,6 +53,13 @@ class EiveHookObject(TmTcHookBase): op_code_dict_srv_imtq = { "0": ("IMTQ Tests All", {OpCodeDictKeys.TIMEOUT: 2.0}), "1": ("IMTQ perform pos X self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "2": ("IMTQ perform neg X self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "3": ("IMTQ perform pos Y self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "4": ("IMTQ perform neg Y self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "5": ("IMTQ perform pos Z self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "6": ("IMTQ perform neg Z self test", {OpCodeDictKeys.TIMEOUT: 2.0}), + "7": ("IMTQ command dipole", {OpCodeDictKeys.TIMEOUT: 2.0}), + "8": ("IMTQ get commanded dipole", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_imtq_tuple = ("IMTQ Device", op_code_dict_srv_imtq) diff --git a/pus_tc/imtq.py b/pus_tc/imtq.py index 838e840..c6bee28 100644 --- a/pus_tc/imtq.py +++ b/pus_tc/imtq.py @@ -28,13 +28,17 @@ class ImtqTestProcedure: positive_z_test = False negative_z_test = False -class SetIds: - POSITIVE_X_TEST = 1 - NEGATIVE_X_TEST = 2 - POSITIVE_Y_TEST = 3 - NEGATIVE_Y_TEST = 4 - POSITIVE_Z_TEST = 5 - NEGATIVE_Z_TEST = 6 + +class ImtqSetIds: + ENG_HK_SET = 1 + CAL_MTM_SET = 2 + RAW_MTM_SET = 3 + POSITIVE_X_TEST = 4 + NEGATIVE_X_TEST = 5 + POSITIVE_Y_TEST = 6 + NEGATIVE_Y_TEST = 7 + POSITIVE_Z_TEST = 8 + NEGATIVE_Z_TEST = 9 class ImtqActionIds: @@ -57,18 +61,6 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) "Testing ISIS IMTQ handler with object id: 0x" + object_id.hex()) ) - if ImtqTestProcedure.all or ImtqTestProcedure.command_dipole: - tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Commanding dipole")) - command = pack_dipole_command(object_id, 2000, 2000, 2000, 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=21, app_data=command) - tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "0" or op_code == "1": tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform positive x self test")) command = object_id + ImtqActionIds.perform_positive_x_test @@ -81,10 +73,106 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive x self test results")) - sid = make_sid(object_id, SetIds.POSITIVE_X_TEST) + sid = make_sid(object_id, ImtqSetIds.POSITIVE_X_TEST) command = generate_one_hk_command(sid, 24) tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "0" or op_code == "2": + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform negative x self test")) + command = object_id + ImtqActionIds.perform_negative_x_test + command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative x self test results")) + command = object_id + ImtqActionIds.read_self_test_results + command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative x self test results")) + sid = make_sid(object_id, ImtqSetIds.NEGATIVE_X_TEST) + command = generate_one_hk_command(sid, 27) + tc_queue.appendleft(command.pack_command_tuple()) + + if op_code == "0" or op_code == "3": + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform positive y self test")) + command = object_id + ImtqActionIds.perform_positive_y_test + command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of positive y self test results")) + command = object_id + ImtqActionIds.read_self_test_results + command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive y self test results")) + sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST) + command = generate_one_hk_command(sid, 30) + tc_queue.appendleft(command.pack_command_tuple()) + + if op_code == "0" or op_code == "4": + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform negative y self test")) + command = object_id + ImtqActionIds.perform_negative_y_test + command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative y self test results")) + command = object_id + ImtqActionIds.read_self_test_results + command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative y self test results")) + sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Y_TEST) + command = generate_one_hk_command(sid, 33) + tc_queue.appendleft(command.pack_command_tuple()) + + if op_code == "0" or op_code == "5": + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform positive z self test")) + command = object_id + ImtqActionIds.perform_positive_z_test + command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of positive z self test results")) + command = object_id + ImtqActionIds.read_self_test_results + command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive z self test results")) + sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST) + command = generate_one_hk_command(sid, 36) + tc_queue.appendleft(command.pack_command_tuple()) + + if op_code == "0" or op_code == "6": + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform negative z self test")) + command = object_id + ImtqActionIds.perform_negative_z_test + command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative z self test results")) + command = object_id + ImtqActionIds.read_self_test_results + command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative z self test results")) + sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Z_TEST) + command = generate_one_hk_command(sid, 37) + tc_queue.appendleft(command.pack_command_tuple()) + + if op_code == "0" or op_code == "7": + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Commanding dipole")) + x_dipole = 0 + y_dipole = 0 + z_dipole = 0 + duration = 0 # ms + command = pack_dipole_command(object_id, x_dipole, y_dipole, z_dipole, duration) + command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + if op_code == "0" or op_code == "8": + tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Get commanded dipole")) + command = object_id + ImtqActionIds.get_commanded_dipole + command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + return tc_queue diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index 99053c2..1d10153 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -8,7 +8,7 @@ from tmtccmd.ecss.tm import PusTelemetry from tmtccmd.utility.logger import get_logger from tmtccmd.pus_tm.service_1_verification import Service1TM -from tmtccmd.pus_tm.service_3_base import Service3Base +from tmtccmd.pus_tm.service_3_housekeeping import Service3TM from tmtccmd.pus_tm.service_5_event import Service5TM from tmtccmd.pus_tm.service_17_test import Service17TM @@ -20,7 +20,7 @@ def tm_user_factory_hook(raw_tm_packet: bytearray) -> PusTelemetry: if service_type == 1: return Service1TM(raw_tm_packet) if service_type == 3: - return Service3Base(raw_tm_packet) + return Service3TM(raw_tm_packet) if service_type == 5: return Service5TM(raw_tm_packet) if service_type == 8: diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py index f38f1e4..f093ae7 100644 --- a/pus_tm/hk_handling.py +++ b/pus_tm/hk_handling.py @@ -4,20 +4,29 @@ @details Template configuration file. Copy this folder to the TMTC commander root and adapt it to your needs. """ +import struct from typing import Tuple -from tmtccmd.pus_tm.service_3_base import Service3Base +from tmtccmd.pus_tm.service_3_housekeeping import Service3Base from tmtccmd.utility.logger import get_logger - +from pus_tc.syrlinks_hk_handler import SetIds +from pus_tc.imtq import ImtqSetIds +from config.object_ids import SYRLINKS_HANDLER, IMTQ_HANDLER_ID LOGGER = get_logger() -def handle_user_hk_packet( - object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base - ) -> Tuple[list, list, bytearray, int]: +def handle_user_hk_packet(object_id: bytes, set_id: int, hk_data: bytearray, + service3_packet: Service3Base) -> Tuple[list, list, bytearray, int]: """ This function is called when a Service 3 Housekeeping packet is received. + Please note that the object IDs should be compared by value because direct comparison of + enumerations does not work in Python. For example use: + + if object_id.value == ObjectIds.TEST_OBJECT.value + + to test equality based on the object ID list. + @param object_id: @param set_id: @param hk_data: @@ -27,5 +36,122 @@ def handle_user_hk_packet( the corresponding values. The bytearray is the validity buffer, which is usually appended at the end of the housekeeping packet. The last value is the number of parameters. """ - LOGGER.info("Service3TM: Parsing for this SID has not been implemented.") - return [], [], bytearray(), 0 + if object_id == SYRLINKS_HANDLER: + if set_id == SetIds.RX_REGISTERS_DATASET: + return handle_syrlinks_rx_registers_dataset(hk_data) + elif set_id == SetIds.TX_REGISTERS_DATASET: + return handle_syrlinks_tx_registers_dataset(hk_data) + else: + LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id") + return [], [], bytearray(), 0 + elif object_id == IMTQ_HANDLER_ID: + if (set_id >= ImtqSetIds.POSITIVE_X_TEST) and (set_id <= ImtqSetIds.NEGATIVE_Z_TEST): + return handle_self_test_data(hk_data) + else: + LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id") + return [], [], bytearray(), 0 + else: + LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.") + return [], [], bytearray(), 0 + + +def handle_syrlinks_rx_registers_dataset(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: + hk_header = [] + hk_content = [] + validity_buffer = bytearray() + hk_header = ["RX Status", "RX Sensitivity", "RX Frequency Shift", "RX IQ Power", "RX AGC Value", "RX Demod Eb", + "RX Demod N0", "RX Datarate"] + rx_status = hk_data[0] + rx_sensitivity = struct.unpack('!I', hk_data[1:5]) + rx_frequency_shift = struct.unpack('!I', hk_data[5:9]) + rx_iq_power = struct.unpack('!H', hk_data[9:11]) + rx_agc_value = struct.unpack('!H', hk_data[11:13]) + rx_demod_eb = struct.unpack('!I', hk_data[13:17]) + rx_demod_n0 = struct.unpack('!I', hk_data[17:21]) + rx_data_rate = hk_data[21] + hk_content = [rx_status, rx_sensitivity, rx_frequency_shift, rx_iq_power, rx_agc_value, rx_demod_eb, rx_demod_n0, + rx_data_rate] + return hk_header, hk_content, validity_buffer, 8 + + +def handle_syrlinks_tx_registers_dataset(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: + hk_header = [] + hk_content = [] + validity_buffer = bytearray() + hk_header = ["TX Status", "TX Waveform", "TX AGC value"] + tx_status = hk_data[0] + tx_waveform = hk_data[1] + tx_agc_value = struct.unpack('!H', hk_data[2:4]) + hk_content = [tx_status, tx_waveform, tx_agc_value] + return hk_header, hk_content, validity_buffer, 3 + + +def handle_self_test_data(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: + hk_header = [] + hk_content = [] + validity_buffer = bytearray() + hk_header = ["Init Err", "Init Raw Mag X [nT]", "Init Raw Mag Y [nT]", "Init Raw Mag Z [nT]", "Init Cal Mag X [nT]", + "Init Cal Mag Y [nT]", "Init Cal Mag Z [nT]", "Init Coil X Current [mA]", "Init Coil Y Current [mA]", + "Init Coil Z Current [mA]", "Init Coil X Temperature [°C]", "Init Coil Y Temperature [°C]", + "Init Coil Z Temperature [°C]", "Err", "Raw Mag X [nT]", "Raw Mag Y [nT]", "Raw Mag Z [nT]", + "Cal Mag X [nT]", "Cal Mag Y [nT]", "Cal Mag Z [nT]", "Coil X Current [mA]", "Coil Y Current [mA]", + "Coil Z Current [mA]", "Coil X Temperature [°C]", "Coil Y Temperature [°C]", "Coil Z Temperature [°C]", + "Fina Err", "Fina Raw Mag X [nT]", "Fina Raw Mag Y [nT]", "Fina Raw Mag Z [nT]", "Fina Cal Mag X [nT]", + "Fina Cal Mag Y [nT]", "Fina Cal Mag Z [nT]", "Fina Coil X Current [mA]", "Fina Coil Y Current [mA]", + "Fina Coil Z Current [mA]", "Fina Coil X Temperature [°C]", "Fina Coil Y Temperature [°C]", + "Fina Coil Z Temperature [°C]"] + # INIT step (no coil actuation) + init_err = hk_data[0] + init_raw_mag_x = struct.unpack('!f', hk_data[1:5])[0] + init_raw_mag_y = struct.unpack('!f', hk_data[5:9])[0] + init_raw_mag_z = struct.unpack('!f', hk_data[9:13])[0] + init_cal_mag_x = struct.unpack('!f', hk_data[13:17])[0] + init_cal_mag_y = struct.unpack('!f', hk_data[17:21])[0] + init_cal_mag_z = struct.unpack('!f', hk_data[21:25])[0] + init_coil_x_current = struct.unpack('!f', hk_data[25:29])[0] + init_coil_y_current = struct.unpack('!f', hk_data[29:33])[0] + init_coil_z_current = struct.unpack('!f', hk_data[33:37])[0] + init_coil_x_temperature = struct.unpack('!H', hk_data[37:39])[0] + init_coil_y_temperature = struct.unpack('!H', hk_data[39:41])[0] + init_coil_z_temperature = struct.unpack('!H', hk_data[41:43])[0] + + # Actuation step + err = hk_data[43] + raw_mag_x = struct.unpack('!f', hk_data[44:48])[0] + raw_mag_y = struct.unpack('!f', hk_data[48:52])[0] + raw_mag_z = struct.unpack('!f', hk_data[52:56])[0] + cal_mag_x = struct.unpack('!f', hk_data[56:60])[0] + cal_mag_y = struct.unpack('!f', hk_data[60:64])[0] + cal_mag_z = struct.unpack('!f', hk_data[64:68])[0] + coil_x_current = struct.unpack('!f', hk_data[68:72])[0] + coil_y_current = struct.unpack('!f', hk_data[72:76])[0] + coil_z_current = struct.unpack('!f', hk_data[76:80])[0] + coil_x_temperature = struct.unpack('!H', hk_data[80:82])[0] + coil_y_temperature = struct.unpack('!H', hk_data[82:84])[0] + coil_z_temperature = struct.unpack('!H', hk_data[84:86])[0] + + # FINA step (no coil actuation) + fina_err = hk_data[86] + fina_raw_mag_x = struct.unpack('!f', hk_data[87:91])[0] + fina_raw_mag_y = struct.unpack('!f', hk_data[91:95])[0] + fina_raw_mag_z = struct.unpack('!f', hk_data[95:99])[0] + fina_cal_mag_x = struct.unpack('!f', hk_data[99:103])[0] + fina_cal_mag_y = struct.unpack('!f', hk_data[103:107])[0] + fina_cal_mag_z = struct.unpack('!f', hk_data[107:111])[0] + fina_coil_x_current = struct.unpack('!f', hk_data[111:115])[0] + fina_coil_y_current = struct.unpack('!f', hk_data[115:119])[0] + fina_coil_z_current = struct.unpack('!f', hk_data[119:123])[0] + fina_coil_x_temperature = struct.unpack('!H', hk_data[123:125])[0] + fina_coil_y_temperature = struct.unpack('!H', hk_data[125:127])[0] + fina_coil_z_temperature = struct.unpack('!H', hk_data[127:129])[0] + + hk_content = [init_err, init_raw_mag_x, init_raw_mag_y, init_raw_mag_z, init_cal_mag_x, init_cal_mag_y, + init_cal_mag_z, init_coil_x_current, init_coil_y_current, init_coil_z_current, + init_coil_x_temperature, init_coil_y_temperature, init_coil_z_temperature, err, raw_mag_x, + init_raw_mag_y, raw_mag_z, cal_mag_x, cal_mag_y, cal_mag_z, coil_x_current, coil_y_current, + coil_z_current, coil_x_temperature, coil_y_temperature, coil_z_temperature, fina_err, fina_raw_mag_x, + fina_raw_mag_y, fina_raw_mag_z, fina_cal_mag_x, fina_cal_mag_y, fina_cal_mag_z, fina_coil_x_current, + fina_coil_y_current, fina_coil_z_current, fina_coil_x_temperature, fina_coil_y_temperature, + fina_coil_z_temperature] + + return hk_header, hk_content, validity_buffer, len(hk_header) diff --git a/pus_tm/hk_handling_hook.py b/pus_tm/hk_handling_hook.py deleted file mode 100644 index 4846480..0000000 --- a/pus_tm/hk_handling_hook.py +++ /dev/null @@ -1,112 +0,0 @@ -""" -@brief This file transfers control of housekeeping handling (PUS service 3) to the - developer -@details Template configuration file. Copy this folder to the TMTC commander root and adapt - it to your needs. -""" -import struct -from typing import Tuple - -from tmtccmd.pus_tm.service_3_housekeeping import Service3Base -from tmtccmd.utility.logger import get_logger -from pus_tc.syrlinks_hk_handler import SetIds -from config.object_ids import SYRLINKS_HANDLER, IMTQ_HANDLER_ID -LOGGER = get_logger() - - -def handle_user_hk_packet(object_id: bytes, set_id: int, hk_data: bytearray, - service3_packet: Service3Base) -> Tuple[list, list, bytearray, int]: - """ - This function is called when a Service 3 Housekeeping packet is received. - - Please note that the object IDs should be compared by value because direct comparison of - enumerations does not work in Python. For example use: - - if object_id.value == ObjectIds.TEST_OBJECT.value - - to test equality based on the object ID list. - - @param object_id: - @param set_id: - @param hk_data: - @param service3_packet: - @return: Expects a tuple, consisting of two lists, a bytearray and an integer - The first list contains the header columns, the second list the list with - the corresponding values. The bytearray is the validity buffer, which is usually appended - at the end of the housekeeping packet. The last value is the number of parameters. - """ - if object_id == SYRLINKS_HANDLER: - if set_id == SetIds.RX_REGISTERS_DATASET: - return handle_syrlinks_rx_registers_dataset(hk_data) - elif set_id == SetIds.TX_REGISTERS_DATASET: - return handle_syrlinks_tx_registers_dataset(hk_data) - else: - LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id") - return [], [], bytearray(), 0 - if object_id == IMTQ_HANDLER_ID: - if set_id == SetIds.RX_REGISTERS_DATASET: - return imtq_positive_x_test(hk_data) - else: - LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id") - return [], [], bytearray(), 0 - else: - LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.") - return [], [], bytearray(), 0 - - -def handle_syrlinks_rx_registers_dataset(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: - hk_header = [] - hk_content = [] - validity_buffer = bytearray() - hk_header = ["RX Status", "RX Sensitivity", "RX Frequency Shift", "RX IQ Power", "RX AGC Value", "RX Demod Eb", - "RX Demod N0", "RX Datarate"] - rx_status = hk_data[0] - rx_sensitivity = struct.unpack('!I', hk_data[1:5]) - rx_frequency_shift = struct.unpack('!I', hk_data[5:9]) - rx_iq_power = struct.unpack('!H', hk_data[9:11]) - rx_agc_value = struct.unpack('!H', hk_data[11:13]) - rx_demod_eb = struct.unpack('!I', hk_data[13:17]) - rx_demod_n0 = struct.unpack('!I', hk_data[17:21]) - rx_data_rate = hk_data[21] - hk_content = [rx_status, rx_sensitivity, rx_frequency_shift, rx_iq_power, rx_agc_value, rx_demod_eb, rx_demod_n0, - rx_data_rate] - return hk_header, hk_content, validity_buffer, 8 - - -def handle_syrlinks_tx_registers_dataset(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: - hk_header = [] - hk_content = [] - validity_buffer = bytearray() - hk_header = ["TX Status", "TX Waveform", "TX AGC value"] - tx_status = hk_data[0] - tx_waveform = hk_data[1] - tx_agc_value = struct.unpack('!H', hk_data[2:4]) - hk_content = [tx_status, tx_waveform, tx_agc_value] - return hk_header, hk_content, validity_buffer, 3 - - -def imtq_positive_x_test(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: - hk_header = [] - hk_content = [] - validity_buffer = bytearray() - hk_header = ["Init Err", "Init Raw Mag X [T]", "Init Raw Mag Y [T]", "Init Raw Mag Z [T]", "Init Cal Mag X [T]", - "Init Cal Mag Y [T]", "Init Cal Mag Z [T]", "Init Coil X Current [A]", "Init Coil Y Current [A]", - "Init Coil Z Current [A]", "Init Coil X Temperature [°C]", "Init Coil Y Temperature [°C]", - "Init Coil Z Temperature [°C]"] - init_err = hk_data[0] - init_raw_mag_x = struct.unpack('!f', hk_data[1:5]) - init_raw_mag_y = struct.unpack('!f', hk_data[5:9]) - init_raw_mag_z = struct.unpack('!f', hk_data[9:13]) - init_cal_mag_x = struct.unpack('!f', hk_data[13:17]) - init_cal_mag_y = struct.unpack('!f', hk_data[17:21]) - init_cal_mag_z = struct.unpack('!f', hk_data[21:25]) - init_coil_x_current = struct.unpack('!f', hk_data[25:29]) - init_coil_y_current = struct.unpack('!f', hk_data[29:33]) - init_coil_z_current = struct.unpack('!f', hk_data[33:37]) - init_coil_x_temperature = struct.unpack('!H', hk_data[37:39]) - init_coil_y_temperature = struct.unpack('!H', hk_data[39:41]) - init_coil_z_temperature = struct.unpack('!H', hk_data[41:43]) - hk_content = [init_err, init_raw_mag_x, init_raw_mag_y, init_raw_mag_z, init_cal_mag_x, init_cal_mag_y, - init_cal_mag_z, init_coil_x_current, init_coil_y_current, init_coil_z_current, - init_coil_x_temperature, init_coil_y_temperature, init_coil_z_temperature] - return hk_header, hk_content, len(hk_header) diff --git a/tmtccmd b/tmtccmd index 39697ed..b36f182 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 39697eda495d1b7f3d39e6c0bb9079856e93d006 +Subproject commit b36f182178cf7fa41b169b705eaf2364a1e29969