update update command

This commit is contained in:
Robin Müller 2022-08-24 12:06:49 +02:00
parent ac7821575c
commit 7885b29d22
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -227,7 +227,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
q.add_log_cmd("PLOC Supervisor: Start MPSoC") q.add_log_cmd("PLOC Supervisor: Start MPSoC")
command = obyt + struct.pack("!I", SupvActionIds.START_MPSOC) command = obyt + struct.pack("!I", SupvActionIds.START_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 == "6": if op_code in OpCodes.STOP_MPSOC:
q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC") q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC")
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SHUTWOWN_MPSOC) command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SHUTWOWN_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))
@ -641,6 +641,13 @@ def pack_update_command(object_id: bytes) -> bytearray:
init_seq_count = input("Specify initial sequence count [1 default]: ") init_seq_count = input("Specify initial sequence count [1 default]: ")
if init_seq_count == "": if init_seq_count == "":
init_seq_count = 0 init_seq_count = 0
del_mem = input("Delete memory? [y/n, y default]: ")
if del_mem.lower() in ["y", "1"]:
del_mem = 1
elif del_mem.lower() in ["n", "0"]:
del_mem = 0
else:
raise ValueError("Invalid input, use y or n")
init_seq_count = int(init_seq_count) init_seq_count = int(init_seq_count)
command += object_id command += object_id
command += struct.pack("!I", SupvActionIds.PERFORM_UPDATE) command += struct.pack("!I", SupvActionIds.PERFORM_UPDATE)
@ -651,6 +658,7 @@ def pack_update_command(object_id: bytes) -> bytearray:
command += struct.pack("!I", start_address) command += struct.pack("!I", start_address)
command.extend(struct.pack("!I", init_bytes_written)) command.extend(struct.pack("!I", init_bytes_written))
command.extend(struct.pack("!H", init_seq_count)) command.extend(struct.pack("!H", init_seq_count))
command.append(del_mem)
return bytearray(command) return bytearray(command)