From a2d04b28fd867373c14827293f20177db1737bb1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 19 Feb 2023 13:25:12 +0100 Subject: [PATCH] set IMTQ set HK handling --- eive_tmtc/pus_tm/hk_handling.py | 14 ++------------ eive_tmtc/tmtc/acs/imtq.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/eive_tmtc/pus_tm/hk_handling.py b/eive_tmtc/pus_tm/hk_handling.py index e5fa1d4..762a447 100644 --- a/eive_tmtc/pus_tm/hk_handling.py +++ b/eive_tmtc/pus_tm/hk_handling.py @@ -32,6 +32,7 @@ from eive_tmtc.tmtc.acs.imtq import ( handle_eng_set, handle_calibrated_mtm_measurement, handle_raw_mtm_measurement, + handle_imtq_hk, ) from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter from eive_tmtc.tmtc.core import handle_core_hk_data @@ -97,18 +98,7 @@ def handle_regular_hk_print( elif objb == obj_ids.SYRLINKS_HANDLER_ID: return handle_syrlinks_hk_data(printer=printer, hk_data=hk_data, set_id=set_id) elif objb == obj_ids.IMTQ_HANDLER_ID: - if (set_id >= ImtqSetId.POSITIVE_X_TEST) and ( - set_id <= ImtqSetId.NEGATIVE_Z_TEST - ): - return handle_self_test_data(printer, hk_data) - elif set_id == ImtqSetId.ENG_HK_NO_TORQUE: - return handle_eng_set(printer, hk_data) - elif set_id == ImtqSetId.CAL_MTM_SET: - return handle_calibrated_mtm_measurement(printer, hk_data) - elif set_id == ImtqSetId.RAW_MTM_NO_TORQUE: - return handle_raw_mtm_measurement(printer, hk_data) - else: - _LOGGER.info("Service 3 TM: IMTQ handler reply with unknown set id") + return handle_imtq_hk(printer=printer, hk_data=hk_data, set_id=set_id) elif objb == obj_ids.GPS_CONTROLLER: return handle_gps_data(printer=printer, hk_data=hk_data) elif objb == obj_ids.PCDU_HANDLER_ID: diff --git a/eive_tmtc/tmtc/acs/imtq.py b/eive_tmtc/tmtc/acs/imtq.py index 3c363f7..6084299 100644 --- a/eive_tmtc/tmtc/acs/imtq.py +++ b/eive_tmtc/tmtc/acs/imtq.py @@ -5,6 +5,7 @@ @author J. Meier @date 25.03.2021 """ +import logging import struct from typing import List @@ -302,6 +303,23 @@ ENG_HK_HEADERS = [ ] +def handle_imtq_hk(printer: FsfwTmTcPrinter, hk_data: bytes, set_id: int): + if (set_id >= ImtqSetId.POSITIVE_X_TEST) and (set_id <= ImtqSetId.NEGATIVE_Z_TEST): + return handle_self_test_data(printer, hk_data) + elif set_id == ImtqSetId.ENG_HK_NO_TORQUE: + return handle_eng_set(printer, hk_data) + elif set_id == ImtqSetId.CAL_MTM_SET: + return handle_calibrated_mtm_measurement(printer, hk_data) + elif set_id == ImtqSetId.RAW_MTM_NO_TORQUE: + return handle_raw_mtm_measurement(printer, hk_data) + elif set_id == ImtqSetId.STATUS_SET: + return handle_status_set(printer, hk_data) + else: + logging.getLogger(__name__).info( + "Service 3 TM: IMTQ handler reply with unknown set id" + ) + + def unpack_status_set(hk_data: bytes) -> List: status_mode = hk_data[0] status_error = hk_data[1]