Merge pull request 'improve supv reset cmd' (#251) from improve-supv-reset-cmd into main
All checks were successful
EIVE/-/pipeline/head This commit looks good

Reviewed-on: #251
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
This commit is contained in:
Marius Eggert 2023-10-27 14:36:22 +02:00
commit f59c2b9a9e

View File

@ -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: