bugfix in mpsoc commands

This commit is contained in:
Jakob Meier 2023-02-28 09:13:14 +01:00
parent 64d0ca491a
commit 56630b05c2

View File

@ -87,6 +87,7 @@ class OpCode:
DOWNLINK_DATA_MODULATE = ["downlink_data_modulate"] DOWNLINK_DATA_MODULATE = ["downlink_data_modulate"]
MODE_SNAPSHOT = ["mode_snapshot"] MODE_SNAPSHOT = ["mode_snapshot"]
class Info: class Info:
ON = "On" ON = "On"
OFF = "Off" OFF = "Off"
@ -134,10 +135,10 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
oce.add("16", "Ploc MPSoC: Tc cam command send") oce.add("16", "Ploc MPSoC: Tc cam command send")
oce.add("17", "Ploc MPSoC: Set UART TX tristate") oce.add("17", "Ploc MPSoC: Set UART TX tristate")
oce.add("18", "Ploc MPSoC: Relesase UART TX") oce.add("18", "Ploc MPSoC: Relesase UART TX")
oce.add(OpCode.CAM_TAKE_PIC, OpCode.CAM_TAKE_PIC) oce.add(OpCode.CAM_TAKE_PIC, Info.CAM_TAKE_PIC)
oce.add(OpCode.SIMPLEX_SEND_FILE, OpCode.SIMPLEX_SEND_FILE) oce.add(OpCode.SIMPLEX_SEND_FILE, Info.SIMPLEX_SEND_FILE)
oce.add(OpCode.DOWNLINK_DATA_MODULATE, OpCode.DOWNLINK_DATA_MODULATE) oce.add(OpCode.DOWNLINK_DATA_MODULATE, Info.DOWNLINK_DATA_MODULATE)
oce.add(OpCode.MODE_SNAPSHOT, OpCode.MODE_SNAPSHOT) oce.add(OpCode.MODE_SNAPSHOT, Info.MODE_SNAPSHOT)
defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce) defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
@ -246,25 +247,24 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
q.add_log_cmd("PLOC MPSoC: Release UART TX") q.add_log_cmd("PLOC MPSoC: Release UART TX")
data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX) data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCode.CAM_TAKE_PIC: if op_code in OpCode.CAM_TAKE_PIC:
q.add_log_cmd("PLOC MPSoC: Cam take picture") q.add_log_cmd("PLOC MPSoC: Cam take picture")
data = prepare_cam_take_pic_cmd(object_id.as_bytes) data = prepare_cam_take_pic_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCode.SIMPLEX_SEND_FILE: if op_code in OpCode.SIMPLEX_SEND_FILE:
q.add_log_cmd("PLOC MPSoC: Simplex send file") q.add_log_cmd("PLOC MPSoC: Simplex send file")
data = prepare_simplex_send_file_cmd(object_id.as_bytes) data = prepare_simplex_send_file_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCode.DOWNLINK_DATA_MODULATE: if op_code in OpCode.DOWNLINK_DATA_MODULATE:
q.add_log_cmd("PLOC MPSoC: Downlink data modulate") q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes) data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCode.MODE_SNAPSHOT: if op_code in OpCode.MODE_SNAPSHOT:
q.add_log_cmd("PLOC MPSoC: Mode snapshot") q.add_log_cmd("PLOC MPSoC: Mode snapshot")
data = object_id.as_bytes + struct.pack('I', CommandId.TC_MODE_SNAPSHOT) data = object_id.as_bytes + struct.pack('!I', CommandId.TC_MODE_SNAPSHOT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
def generate_write_mem_command( def generate_write_mem_command(
object_id: bytes, memory_address: int, memory_data: int, mem_len: int object_id: bytes, memory_address: int, memory_data: int, mem_len: int
) -> bytearray: ) -> bytearray:
@ -356,6 +356,17 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray: def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
selection = input("Use default parameter? (Y/N): ")
if selection is "Y" or selection is "y":
filename = "0:/test"
encoder_setting_y = 7
quantization_y = 0
encoder_setting_cb = 7
quantization_cb = 0
encoder_setting_cr = 7
quantization_cr = 0
bypass_compressor = 0
else:
filename = input("Specify filename: ") filename = input("Specify filename: ")
encoder_setting_y = int(input("Specify encoderSetting_Y: ")) encoder_setting_y = int(input("Specify encoderSetting_Y: "))
quantization_y = int(input("Specify quantization_Y: ")) quantization_y = int(input("Specify quantization_Y: "))