MPSoC commands #169

Merged
muellerr merged 5 commits from meier/mpsoc-commands into main 2023-03-13 11:03:27 +01:00
Showing only changes of commit 56630b05c2 - Show all commits

View File

@ -87,6 +87,7 @@ class OpCode:
DOWNLINK_DATA_MODULATE = ["downlink_data_modulate"]
MODE_SNAPSHOT = ["mode_snapshot"]
class Info:
ON = "On"
OFF = "Off"
@ -134,10 +135,10 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
oce.add("16", "Ploc MPSoC: Tc cam command send")
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
oce.add("18", "Ploc MPSoC: Relesase UART TX")
oce.add(OpCode.CAM_TAKE_PIC, OpCode.CAM_TAKE_PIC)
oce.add(OpCode.SIMPLEX_SEND_FILE, OpCode.SIMPLEX_SEND_FILE)
oce.add(OpCode.DOWNLINK_DATA_MODULATE, OpCode.DOWNLINK_DATA_MODULATE)
oce.add(OpCode.MODE_SNAPSHOT, OpCode.MODE_SNAPSHOT)
oce.add(OpCode.CAM_TAKE_PIC, Info.CAM_TAKE_PIC)
oce.add(OpCode.SIMPLEX_SEND_FILE, Info.SIMPLEX_SEND_FILE)
oce.add(OpCode.DOWNLINK_DATA_MODULATE, Info.DOWNLINK_DATA_MODULATE)
oce.add(OpCode.MODE_SNAPSHOT, Info.MODE_SNAPSHOT)
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")
data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX)
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")
data = prepare_cam_take_pic_cmd(object_id.as_bytes)
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")
data = prepare_simplex_send_file_cmd(object_id.as_bytes)
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")
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
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")
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))
def generate_write_mem_command(
object_id: bytes, memory_address: int, memory_data: int, mem_len: int
) -> bytearray:
@ -356,14 +356,25 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
filename = input("Specify filename: ")
encoder_setting_y = int(input("Specify encoderSetting_Y: "))
quantization_y = int(input("Specify quantization_Y: "))
encoder_setting_cb = int(input("Specify encoderSetting_Cb: "))
quantization_cb = int(input("Specify quantization_Cb: "))
encoder_setting_cr = int(input("Specify encoderSetting_Cr: "))
quantization_cr = int(input("Specify quantization_Cr: "))
bypass_compressor = int(input("Specify bypassCompressor: "))
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: ")
encoder_setting_y = int(input("Specify encoderSetting_Y: "))
quantization_y = int(input("Specify quantization_Y: "))
encoder_setting_cb = int(input("Specify encoderSetting_Cb: "))
quantization_cb = int(input("Specify quantization_Cb: "))
encoder_setting_cr = int(input("Specify encoderSetting_Cr: "))
quantization_cr = int(input("Specify quantization_Cr: "))
bypass_compressor = int(input("Specify bypassCompressor: "))
command = (
object_id
+ struct.pack("!I", CommandId.TC_CAM_TAKE_PIC)