Added the following commands (not tested yet):
* TcCamTakePic * TcSimplexSendFile * TcDownlinkDataModulate * TcModeSnapshot
This commit is contained in:
parent
9b7471e909
commit
8d036bcd4f
@ -66,6 +66,10 @@ class CommandId(enum.IntEnum):
|
||||
TC_MODE_IDLE = 18
|
||||
SET_UART_TX_TRISTATE = 20
|
||||
RELEASE_UART_TX = 21
|
||||
TC_CAM_TAKE_PIC = 22
|
||||
TC_SIMPLEX_SEND_FILE = 23
|
||||
TC_DOWNLINK_DATA_MODULATE = 24
|
||||
TC_MODE_SNAPSHOT = 25
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -78,7 +82,10 @@ class OpCode:
|
||||
REPLAY_WRITE_SEQ = ["replay_write"]
|
||||
DOWNLINK_PWR_ON = ["downlink_pwr_on"]
|
||||
REPLAY_START = ["replay_start"]
|
||||
|
||||
CAM_TAKE_PIC = ["cam_take_pic"]
|
||||
SIMPLEX_SEND_FILE = ["simplex_send_file"]
|
||||
DOWNLINK_DATA_MODULATE = ["downlink_data_modulate"]
|
||||
MODE_SNAPSHOT = ["mode_snapshot"]
|
||||
|
||||
class Info:
|
||||
ON = "On"
|
||||
@ -90,6 +97,10 @@ class Info:
|
||||
REPLAY_WRITE_SEQ = "Replay write sequence"
|
||||
DOWNLINK_PWR_ON = "Downlink Power On"
|
||||
REPLAY_START = "Replay Start"
|
||||
CAM_TAKE_PIC = "Cam Take Picture"
|
||||
SIMPLEX_SEND_FILE = "Simplex Send File"
|
||||
DOWNLINK_DATA_MODULATE = "Downlink data modulate"
|
||||
MODE_SNAPSHOT = "Mode Snapshot"
|
||||
|
||||
|
||||
class MemAddresses(enum.IntEnum):
|
||||
@ -123,6 +134,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)
|
||||
defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
|
||||
|
||||
|
||||
@ -231,6 +246,23 @@ 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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
q.add_log_cmd("PLOC MPSoC: 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(
|
||||
@ -267,13 +299,13 @@ def prepare_mem_read_command(object_id: bytes) -> bytearray:
|
||||
|
||||
|
||||
def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
|
||||
obcFile = get_obc_file()
|
||||
mpsocFile = get_mpsoc_file()
|
||||
obc_file = get_obc_file()
|
||||
mpsoc_file = get_mpsoc_file()
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandId.FLASH_WRITE)
|
||||
+ bytearray(obcFile, "utf-8")
|
||||
+ bytearray(mpsocFile, "utf-8")
|
||||
+ bytearray(obc_file, "utf-8")
|
||||
+ bytearray(mpsoc_file, "utf-8")
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
@ -323,6 +355,58 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
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: "))
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandId.TC_CAM_TAKE_PIC)
|
||||
+ bytearray(filename, "utf-8")
|
||||
+ bytes([0])
|
||||
+ struct.pack('!B', encoder_setting_y)
|
||||
+ struct.pack('!Q', quantization_y)
|
||||
+ struct.pack('!B', encoder_setting_cb)
|
||||
+ struct.pack('!Q', quantization_cb)
|
||||
+ struct.pack('!B', encoder_setting_cr)
|
||||
+ struct.pack('!Q', quantization_cr)
|
||||
+ struct.pack('!B', bypass_compressor)
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def prepare_simplex_send_file_cmd(object_id: bytes) -> bytearray:
|
||||
filename = input("Specify filename: ")
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandId.TC_SIMPLEX_SEND_FILE)
|
||||
+ bytearray(filename, "utf-8")
|
||||
+ bytes([0])
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
|
||||
format = int(input("Specify format: "))
|
||||
src_mem_addr = int(input("Specify srcMemAddr: "))
|
||||
src_mem_len = int(input("Specify srcMemLen: "))
|
||||
dest_mem_addr = int(input("Specify destMemAddr: "))
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandId.TC_DOWNLINK_DATA_MODULATE)
|
||||
+ struct.pack('!B', format)
|
||||
+ struct.pack('!I', src_mem_addr)
|
||||
+ struct.pack('!H', src_mem_len)
|
||||
+ struct.pack('!I', dest_mem_addr)
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def get_obc_file() -> str:
|
||||
_LOGGER.info("Specify OBC file ")
|
||||
input_helper = InputHelper(flash_write_file_dict)
|
||||
|
Loading…
Reference in New Issue
Block a user