From ddc80071e0a084229a415c97ddf51b3b6791496c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Jun 2023 10:43:11 +0200 Subject: [PATCH 1/4] changelogge --- CHANGELOG.md | 4 ++++ eive_tmtc/config/object_ids.py | 1 + eive_tmtc/pus_tm/hk_handling.py | 3 +++ .../pus_tm/{factory_hook.py => pus_demux.py} | 0 eive_tmtc/tmtc/internal_err_reporter.py | 24 +++++++++++++++++++ tmtcc.py | 2 +- 6 files changed, 33 insertions(+), 1 deletion(-) rename eive_tmtc/pus_tm/{factory_hook.py => pus_demux.py} (100%) create mode 100644 eive_tmtc/tmtc/internal_err_reporter.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f20da8..f7ae431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ list yields a list of all related PRs for each release. # [unreleased] +## Added + +- Internal error reporter dataset handling. + # [v5.0.0] ## Changed diff --git a/eive_tmtc/config/object_ids.py b/eive_tmtc/config/object_ids.py index 21e7822..4d09d9e 100644 --- a/eive_tmtc/config/object_ids.py +++ b/eive_tmtc/config/object_ids.py @@ -18,6 +18,7 @@ __OBJECT_ID_DICT = None # Core Object IDs SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x00, 0xA2]) +INTERNAL_ERROR_REPORTER_ID = bytes([0x53, 0x04, 0x00, 0x00]) # Power Object IDs PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0xA1]) diff --git a/eive_tmtc/pus_tm/hk_handling.py b/eive_tmtc/pus_tm/hk_handling.py index e149371..ca81bb3 100644 --- a/eive_tmtc/pus_tm/hk_handling.py +++ b/eive_tmtc/pus_tm/hk_handling.py @@ -3,6 +3,7 @@ import logging # from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data +from eive_tmtc.tmtc.internal_err_reporter import handle_ier_hk_data from eive_tmtc.tmtc.payload.ploc_mpsoc import handle_ploc_mpsoc_hk_data from eive_tmtc.tmtc.tcs.rtd import RTD_NAMES, handle_rtd_hk from eive_tmtc.tmtc.acs.star_tracker import handle_str_hk_data @@ -122,6 +123,8 @@ def handle_regular_hk_print( # noqa C901: Complexity okay here return handle_ploc_mpsoc_hk_data(pw=pw, hk_data=hk_data, set_id=set_id) elif objb == obj_ids.ACU_HANDLER_ID: return handle_acu_hk_data(pw=pw, hk_data=hk_data, set_id=set_id) + elif objb == obj_ids.INTERNAL_ERROR_REPORTER_ID: + return handle_ier_hk_data(pw=pw, hk_data=hk_data, set_id=set_id) elif objb == obj_ids.RAD_SENSOR_ID: return handle_rad_sensor_data(pw=pw, hk_data=hk_data, set_id=set_id) elif objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]: diff --git a/eive_tmtc/pus_tm/factory_hook.py b/eive_tmtc/pus_tm/pus_demux.py similarity index 100% rename from eive_tmtc/pus_tm/factory_hook.py rename to eive_tmtc/pus_tm/pus_demux.py diff --git a/eive_tmtc/tmtc/internal_err_reporter.py b/eive_tmtc/tmtc/internal_err_reporter.py new file mode 100644 index 0000000..6c26c5f --- /dev/null +++ b/eive_tmtc/tmtc/internal_err_reporter.py @@ -0,0 +1,24 @@ +import enum +import struct + +from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter + +from eive_tmtc.pus_tm.defs import PrintWrapper + + +class SetId(enum.IntEnum): + ERROR_ID = 0 + + +def handle_ier_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int): + pw.dlog(f"Received internal error reporter HK data with set ID {set_id}") + if set_id == SetId.ERROR_ID: + fmt_str = "!III" + inc_len = struct.calcsize(fmt_str) + (tm_errors, queue_errors, store_hits) = struct.unpack( + fmt_str, hk_data[:inc_len] + ) + pw.dlog(f"TM Errors: {tm_errors}") + pw.dlog(f"Queue Errors: {queue_errors}") + pw.dlog(f"Store Errors: {store_hits}") + pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[inc_len:], 3)) diff --git a/tmtcc.py b/tmtcc.py index 739ecf0..94a8d84 100755 --- a/tmtcc.py +++ b/tmtcc.py @@ -94,7 +94,7 @@ from eive_tmtc.config.definitions import ( CFDP_REMOTE_ENTITY_ID, ) from eive_tmtc.config.hook import EiveHookObject -from eive_tmtc.pus_tm.factory_hook import pus_factory_hook +from eive_tmtc.pus_tm.pus_demux import pus_factory_hook from eive_tmtc.pus_tc.procedure_packer import handle_default_procedure _LOGGER = APP_LOGGER -- 2.43.0 From 9c5d6a15db30c3b1158f91974149d28987780a3f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Jun 2023 13:10:10 +0200 Subject: [PATCH 2/4] APP logger should be root logger --- eive_tmtc/__init__.py | 2 +- eive_tmtc/pus_tm/hk_handling.py | 4 +++- eive_tmtc/pus_tm/pus_demux.py | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/eive_tmtc/__init__.py b/eive_tmtc/__init__.py index 257095c..15d811a 100644 --- a/eive_tmtc/__init__.py +++ b/eive_tmtc/__init__.py @@ -11,4 +11,4 @@ VERSION_REVISION = 0 EIVE_TMTC_ROOT = Path(__file__).parent PACKAGE_ROOT = EIVE_TMTC_ROOT.parent -APP_LOGGER = logging.getLogger(__name__) +APP_LOGGER = logging.getLogger() diff --git a/eive_tmtc/pus_tm/hk_handling.py b/eive_tmtc/pus_tm/hk_handling.py index ca81bb3..68cf432 100644 --- a/eive_tmtc/pus_tm/hk_handling.py +++ b/eive_tmtc/pus_tm/hk_handling.py @@ -73,7 +73,9 @@ def handle_hk_packet( hk_data=hk_data, ) try: - if HK_OUTPUT_LEVEL > 0: + if HK_OUTPUT_LEVEL == 1: + pass + elif HK_OUTPUT_LEVEL > 1: handle_regular_hk_print( printer=printer, object_id=named_obj_id, diff --git a/eive_tmtc/pus_tm/pus_demux.py b/eive_tmtc/pus_tm/pus_demux.py index 6b74468..89ccb11 100644 --- a/eive_tmtc/pus_tm/pus_demux.py +++ b/eive_tmtc/pus_tm/pus_demux.py @@ -35,6 +35,7 @@ def pus_factory_hook( # noqa C901 : Complexity okay here return try: tm_packet = PusTelemetry.unpack(packet, CdsShortTimestamp.empty()) + # _LOGGER.info(f"Sequence count: {tm_packet.seq_count}") except ValueError as value_error: _LOGGER.warning(f"{value_error}") _LOGGER.warning("Could not generate PUS TM object from raw data") -- 2.43.0 From 03ec5bdc392200df8992be294d41831e4282fe05 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Jun 2023 13:14:07 +0200 Subject: [PATCH 3/4] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ae431..78bd5b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ list yields a list of all related PRs for each release. - Internal error reporter dataset handling. +## Fixed + +- `APP_LOGGER` is the root logger now. + # [v5.0.0] ## Changed -- 2.43.0 From 4a983958bf78533e249d1971f2ed9346a8a09b72 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Jun 2023 13:15:01 +0200 Subject: [PATCH 4/4] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78bd5b7..bed21f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,11 @@ list yields a list of all related PRs for each release. - `APP_LOGGER` is the root logger now. +## Changed + +- HK is only displayed in brief format per default now. This will soon be adaptable by CLI + argument. + # [v5.0.0] ## Changed -- 2.43.0