From 84f50bab83db2c783c54dcf63263fdf175445521 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 26 Oct 2023 11:18:30 +0200 Subject: [PATCH] improve supv reset cmd --- eive_tmtc/tmtc/payload/ploc_supervisor.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_supervisor.py b/eive_tmtc/tmtc/payload/ploc_supervisor.py index 189c0ca..31e8071 100644 --- a/eive_tmtc/tmtc/payload/ploc_supervisor.py +++ b/eive_tmtc/tmtc/payload/ploc_supervisor.py @@ -151,6 +151,7 @@ class OpCodes: PERFORM_UPDATE = ["update"] FACTORY_RESET = ["factory_reset"] MEM_CHECK = ["mem_check"] + RESET_MPSOC = "reset_mpsoc" class Info(str, enum.Enum): @@ -168,6 +169,7 @@ class Info(str, enum.Enum): REQ_BOOT_STATUS_REPORT = "Request boot status report and HK" MEM_CHECK = "Memory Check" SEL_NVM = "Select NVM" + RESET_MPSOC = "Reset MPSoC" @tmtc_definitions_provider @@ -183,8 +185,8 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCodes.SEL_NVM, Info.SEL_NVM) oce.add(OpCodes.SET_TIME_REF, Info.SET_TIME_REF) oce.add(OpCodes.FACTORY_RESET, Info.FACTORY_RESET) + oce.add(OpCodes.RESET_MPSOC, Info.RESET_MPSOC) oce.add("8", "PLOC Supervisor: Set max restart tries") - oce.add("9", "PLOC Supervisor: Reset MPSoC") oce.add("11", "PLOC Supervisor: Set boot timeout") oce.add("12", "PLOC Supervisor: Disable Hk") oce.add(OpCodes.REQ_BOOT_STATUS_REPORT, Info.REQ_BOOT_STATUS_REPORT) @@ -268,7 +270,6 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901 q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) if op_code in OpCodes.FACTORY_RESET: q.add_log_cmd(f"{prefix}: {Info.FACTORY_RESET}") - key = -1 while True: print("Please select the key for a factory reset operation") for key, val in FACTORY_RESET_OPS.items(): @@ -293,8 +294,8 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901 + struct.pack("!B", restart_tries) ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "9": - q.add_log_cmd("PLOC Supervisor: Reset MPSoC") + if op_code == OpCodes.RESET_MPSOC: + q.add_log_cmd(Info.RESET_MPSOC) command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_MPSOC) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) if op_code in OpCodes.SET_TIME_REF: