improve supv reset cmd
EIVE/-/pipeline/head This commit looks good Details
EIVE/-/pipeline/pr-main This commit looks good Details

This commit is contained in:
Robin Müller 2023-10-26 11:18:30 +02:00
parent 43d6b98695
commit 84f50bab83
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
1 changed files with 5 additions and 4 deletions

View File

@ -151,6 +151,7 @@ class OpCodes:
PERFORM_UPDATE = ["update"] PERFORM_UPDATE = ["update"]
FACTORY_RESET = ["factory_reset"] FACTORY_RESET = ["factory_reset"]
MEM_CHECK = ["mem_check"] MEM_CHECK = ["mem_check"]
RESET_MPSOC = "reset_mpsoc"
class Info(str, enum.Enum): class Info(str, enum.Enum):
@ -168,6 +169,7 @@ class Info(str, enum.Enum):
REQ_BOOT_STATUS_REPORT = "Request boot status report and HK" REQ_BOOT_STATUS_REPORT = "Request boot status report and HK"
MEM_CHECK = "Memory Check" MEM_CHECK = "Memory Check"
SEL_NVM = "Select NVM" SEL_NVM = "Select NVM"
RESET_MPSOC = "Reset MPSoC"
@tmtc_definitions_provider @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.SEL_NVM, Info.SEL_NVM)
oce.add(OpCodes.SET_TIME_REF, Info.SET_TIME_REF) oce.add(OpCodes.SET_TIME_REF, Info.SET_TIME_REF)
oce.add(OpCodes.FACTORY_RESET, Info.FACTORY_RESET) 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("8", "PLOC Supervisor: Set max restart tries")
oce.add("9", "PLOC Supervisor: Reset MPSoC")
oce.add("11", "PLOC Supervisor: Set boot timeout") oce.add("11", "PLOC Supervisor: Set boot timeout")
oce.add("12", "PLOC Supervisor: Disable Hk") oce.add("12", "PLOC Supervisor: Disable Hk")
oce.add(OpCodes.REQ_BOOT_STATUS_REPORT, Info.REQ_BOOT_STATUS_REPORT) 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)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code in OpCodes.FACTORY_RESET: if op_code in OpCodes.FACTORY_RESET:
q.add_log_cmd(f"{prefix}: {Info.FACTORY_RESET}") q.add_log_cmd(f"{prefix}: {Info.FACTORY_RESET}")
key = -1
while True: while True:
print("Please select the key for a factory reset operation") print("Please select the key for a factory reset operation")
for key, val in FACTORY_RESET_OPS.items(): 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) + struct.pack("!B", restart_tries)
) )
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "9": if op_code == OpCodes.RESET_MPSOC:
q.add_log_cmd("PLOC Supervisor: Reset MPSoC") q.add_log_cmd(Info.RESET_MPSOC)
command = object_id.as_bytes + struct.pack("!I", SupvActionId.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)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code in OpCodes.SET_TIME_REF: if op_code in OpCodes.SET_TIME_REF: