From aef9af3096cc417c578112ed72b6784f9a7a0aa6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 18 Aug 2022 16:19:09 +0200 Subject: [PATCH] print some more info for PUS1 verif failures --- deps/spacepackets | 2 +- deps/tmtccmd | 2 +- pus_tm/factory_hook.py | 4 ++-- pus_tm/verification_handler.py | 18 +++++++++++++----- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/deps/spacepackets b/deps/spacepackets index 13a5471..6d35a86 160000 --- a/deps/spacepackets +++ b/deps/spacepackets @@ -1 +1 @@ -Subproject commit 13a54713ae283faf0b272dc6c1373ed459efb9b6 +Subproject commit 6d35a8684550207df055cdefbf1e633429f591fd diff --git a/deps/tmtccmd b/deps/tmtccmd index 022f772..b02ab67 160000 --- a/deps/tmtccmd +++ b/deps/tmtccmd @@ -1 +1 @@ -Subproject commit 022f7729b841006f8573e16f573051cc763786df +Subproject commit b02ab670fa16b78fe521fc23255bb43b505fc427 diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index 1ccdc7a..e243998 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -11,7 +11,7 @@ from tmtccmd.tm.pus_17_test import Service17TmExtended from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter from .event_handler import handle_event_packet -from .verification_handler import handle_service_1_packet +from .verification_handler import handle_service_1_fsfw_packet from .hk_handling import handle_hk_packet from .action_reply_handler import handle_action_reply @@ -38,7 +38,7 @@ def pus_factory_hook( obj_id_dict = get_object_ids() dedicated_handler = True if service == 1: - handle_service_1_packet(wrapper=verif_wrapper, raw_tm=packet) + handle_service_1_fsfw_packet(wrapper=verif_wrapper, raw_tm=packet) elif service == 3: handle_hk_packet(printer=printer, raw_tm=packet, obj_id_dict=obj_id_dict) elif service == 5: diff --git a/pus_tm/verification_handler.py b/pus_tm/verification_handler.py index ab81958..508dcd2 100644 --- a/pus_tm/verification_handler.py +++ b/pus_tm/verification_handler.py @@ -1,18 +1,20 @@ -from spacepackets.ecss.pus_1_verification import UnpackParams +from spacepackets.ecss.pus_1_verification import UnpackParams, Service1Tm from tmtccmd.logging import get_console_logger from tmtccmd.pus import VerificationWrapper -from tmtccmd.tm.pus_1_verification import Service1TmExtended +from tmtccmd.tm.pus_1_verification import Service1TmExtended, Service1FsfwWrapper from config.retvals import get_retval_dict LOGGER = get_console_logger() -def handle_service_1_packet(wrapper: VerificationWrapper, raw_tm: bytes): +def handle_service_1_fsfw_packet(wrapper: VerificationWrapper, raw_tm: bytes): if wrapper.console_logger is None or wrapper.file_logger is None: raise ValueError( "Console logger or file logger not valid. Please set a valid one" ) - tm_packet = Service1TmExtended.unpack(data=raw_tm, params=UnpackParams(1, 1)) + # Error code with length 2 is FSFW specific + tm_packet = Service1Tm.unpack(data=raw_tm, params=UnpackParams(1, 2)) + fsfw_wrapper = Service1FsfwWrapper(tm_packet) res = wrapper.verificator.add_tm(tm_packet) if res is None: LOGGER.info( @@ -34,8 +36,14 @@ def handle_service_1_packet(wrapper: VerificationWrapper, raw_tm: bytes): ) else: retval_string = ( - f"Error Code information for code {tm_packet.error_code} | " + f"Error Code information for code {tm_packet.error_code.val:#06x} | " f"Name: {retval_info.name} | Info: {retval_info.info}" ) + error_param_1_str = f"Error Parameter 1: hex {fsfw_wrapper.error_param_1:#010x} dec{fsfw_wrapper.error_param_1} " + error_param_2_str = f"Error Parameter 2: hex {fsfw_wrapper.error_param_2:#010x} dec {fsfw_wrapper.error_param_2}" wrapper.console_logger.info(retval_string) wrapper.file_logger.info(retval_string) + wrapper.console_logger.info(error_param_1_str) + wrapper.file_logger.info(error_param_1_str) + wrapper.console_logger.info(error_param_2_str) + wrapper.file_logger.info(error_param_2_str)