Mode handling fix #300

Open
muellerr wants to merge 5 commits from mode-handling-fix into main
2 changed files with 12 additions and 8 deletions

View File

@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
# [unreleased] # [unreleased]
## Fixed
- Use new mode TM API.
# [v7.0.0] 2024-05-06 # [v7.0.0] 2024-05-06
- Reworked PLOC MPSoC commanding to be inline with OBSW update. - Reworked PLOC MPSoC commanding to be inline with OBSW update.

View File

@ -15,7 +15,7 @@ from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
from tmtccmd.pus import VerificationWrapper from tmtccmd.pus import VerificationWrapper
from tmtccmd.pus.s20_fsfw_param import Service20FsfwTm, Service20ParamDumpWrapper from tmtccmd.pus.s20_fsfw_param import Service20FsfwTm, Service20ParamDumpWrapper
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice 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.pus.s200_fsfw_mode import Subservice as ModeSubservice
from tmtccmd.tmtc import GenericApidHandlerBase, SpecificApidHandlerBase from tmtccmd.tmtc import GenericApidHandlerBase, SpecificApidHandlerBase
from eive_tmtc.config.definitions import TM_DB_PATH, PUS_APID from eive_tmtc.config.definitions import TM_DB_PATH, PUS_APID
@ -109,7 +109,7 @@ class PusHandler(SpecificApidHandlerBase):
elif service == 20: elif service == 20:
self._handle_param_packet(packet, tm_packet) self._handle_param_packet(packet, tm_packet)
elif service == 200: elif service == 200:
dedicated_handler = self._handle_mode_packet(packet, tm_packet) dedicated_handler = self._handle_mode_packet(tm_packet)
else: else:
_LOGGER.info( _LOGGER.info(
f"The service {service} is not implemented in Telemetry Factory" 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" f"unknown subservice {tm_packet.subservice} for parameter service"
) )
def _handle_mode_packet(self, raw_data: bytes, _: PusTelemetry) -> bool: def _handle_mode_packet(self, pus_tm: PusTelemetry) -> bool:
tm_packet = Service200FsfwTm.unpack( tm_packet = Service200FsfwReader(pus_tm)
raw_telemetry=raw_data, time_reader=CdsShortTimestamp.empty() if tm_packet.tm.subservice == ModeSubservice.TM_CANT_REACH_MODE:
)
if tm_packet.subservice == ModeSubservice.TM_CANT_REACH_MODE:
obj_id = tm_packet.object_id obj_id = tm_packet.object_id
obj_id_obj = self.obj_id_dict.get(obj_id) obj_id_obj = self.obj_id_dict.get(obj_id)
retval = tm_packet.return_value retval = tm_packet.return_value
assert retval is not None
string_list = generic_retval_printout(retval) string_list = generic_retval_printout(retval)
self.pw.dlog(f"Received Mode Reply from {obj_id_obj}: Can't reach mode.") self.pw.dlog(f"Received Mode Reply from {obj_id_obj}: Can't reach mode.")
for string in string_list: for string in string_list:
self.pw.dlog(f"Reason: {string}") self.pw.dlog(f"Reason: {string}")
return True 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}") self.pw.dlog(f"Received Mode TM wrong mode reply, mode: {tm_packet.mode}")
return True
return False return False