diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d834be..4015efc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ list yields a list of all related PRs for each release. - Bumped `tmtccmd` to v8.1.0 +## Fixed + +- Use new mode TM API. + # [v7.0.0] 2024-05-06 - Reworked PLOC MPSoC commanding to be inline with OBSW update. diff --git a/eive_tmtc/pus_tm/pus_handler.py b/eive_tmtc/pus_tm/pus_handler.py index 805c6ec..ccd09f9 100644 --- a/eive_tmtc/pus_tm/pus_handler.py +++ b/eive_tmtc/pus_tm/pus_handler.py @@ -15,7 +15,7 @@ from tmtccmd.logging.pus import RawTmtcTimedLogWrapper from tmtccmd.pus import VerificationWrapper from tmtccmd.pus.s20_fsfw_param import Service20FsfwTm, Service20ParamDumpWrapper from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice -from tmtccmd.pus.s200_fsfw_mode import Service200FsfwTm +from tmtccmd.pus.s200_fsfw_mode import Service200FsfwReader, Service200FsfwTm from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice from tmtccmd.tmtc import GenericApidHandlerBase, SpecificApidHandlerBase from eive_tmtc.config.definitions import TM_DB_PATH, PUS_APID @@ -109,7 +109,7 @@ class PusHandler(SpecificApidHandlerBase): elif service == 20: self._handle_param_packet(packet, tm_packet) elif service == 200: - dedicated_handler = self._handle_mode_packet(packet, tm_packet) + dedicated_handler = self._handle_mode_packet(tm_packet) else: _LOGGER.info( f"The service {service} is not implemented in Telemetry Factory" @@ -193,21 +193,21 @@ class PusHandler(SpecificApidHandlerBase): f"unknown subservice {tm_packet.subservice} for parameter service" ) - def _handle_mode_packet(self, raw_data: bytes, _: PusTelemetry) -> bool: - tm_packet = Service200FsfwTm.unpack( - raw_telemetry=raw_data, time_reader=CdsShortTimestamp.empty() - ) - if tm_packet.subservice == ModeSubservice.TM_CANT_REACH_MODE: + def _handle_mode_packet(self, pus_tm: PusTelemetry) -> bool: + tm_packet = Service200FsfwReader(pus_tm) + if tm_packet.tm.subservice == ModeSubservice.TM_CANT_REACH_MODE: obj_id = tm_packet.object_id obj_id_obj = self.obj_id_dict.get(obj_id) retval = tm_packet.return_value + assert retval is not None string_list = generic_retval_printout(retval) self.pw.dlog(f"Received Mode Reply from {obj_id_obj}: Can't reach mode.") for string in string_list: self.pw.dlog(f"Reason: {string}") return True - if tm_packet.subservice == ModeSubservice.TM_WRONG_MODE_REPLY: + if tm_packet.tm.subservice == ModeSubservice.TM_WRONG_MODE_REPLY: self.pw.dlog(f"Received Mode TM wrong mode reply, mode: {tm_packet.mode}") + return True return False