improve syrlinks commanding a bit

This commit is contained in:
Robin Müller 2023-01-10 10:27:00 +01:00
parent a7326b95c4
commit c4dbf3d8be
2 changed files with 40 additions and 18 deletions

View File

@ -29,8 +29,21 @@ class OpCodes:
OFF = "off"
ON = "on"
NORMAL = "nml"
STANDBY = "standby"
STANDBY = "set_tx_standby"
SET_CW = "set_tx_carrier_wave"
MODULATION = "modulation"
HK_RX_REGS = "hk_rx_regs"
HK_TX_REGS = "hk_tx_regs"
TX_STATUS = "tx_status"
RX_STATUS = "rx_status"
class Info:
HK_RX_REGS = "Request RX register set"
HK_TX_REGS = "Request TX register set"
TX_STATUS = "Read TX status (always read in normal mode)"
RX_STATUS = "Read RX status (always read in normal mode)"
SET_CW = "Set TX carrier wave"
class CommandIds:
@ -59,13 +72,15 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCodes.NORMAL, "Syrlinks Handler: Set mode normal")
oce.add(OpCodes.STANDBY, "Syrlinks Handler: Set TX standby")
oce.add(OpCodes.MODULATION, "Syrlinks Handler: Set TX modulation")
oce.add("5", "Syrlinks Handler: Set TX carrier wave")
oce.add("6", "Syrlinks Handler: Read TX status")
oce.add(OpCodes.HK_RX_REGS, Info.HK_RX_REGS)
oce.add(OpCodes.HK_TX_REGS, Info.HK_TX_REGS)
oce.add(OpCodes.SET_CW, Info.SET_CW)
oce.add(OpCodes.TX_STATUS, Info.TX_STATUS)
oce.add(OpCodes.RX_STATUS, Info.RX_STATUS)
oce.add("7", "Syrlinks Handler: Read TX waveform")
oce.add("8", "Syrlinks Handler: Read TX AGC value high byte")
oce.add("9", "Syrlinks Handler: Read TX AGC value low byte")
oce.add("12", "Syrlinks Handler: Write LCL config")
oce.add("13", "Syrlinks Handler: Read RX status registers")
oce.add("14", "Syrlinks Handler: Read LCL config register")
oce.add("15", "Syrlinks Handler: Set waveform OQPSK")
oce.add("16", "Syrlinks Handler: Set waveform BPSK")
@ -79,41 +94,42 @@ def pack_syrlinks_command(
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
):
obyt = object_id.as_bytes
prefix = "Syrlinks"
q.add_log_cmd(f"Testing Syrlinks with object id: {object_id.as_hex_string}")
if op_code == OpCodes.OFF:
q.add_log_cmd("Syrlinks: Set mode off")
q.add_log_cmd(f"{prefix}: Set mode off")
data = pack_mode_data(obyt, Modes.OFF, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == OpCodes.ON:
q.add_log_cmd("Syrlinks: Set mode on")
q.add_log_cmd(f"{prefix}: Set mode on")
data = pack_mode_data(obyt, Modes.ON, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == OpCodes.NORMAL:
q.add_log_cmd("Syrlinks: Mode Normal")
q.add_log_cmd(f"{prefix}: Mode Normal")
data = pack_mode_data(obyt, Modes.NORMAL, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == OpCodes.STANDBY:
q.add_log_cmd("syrlinks: Set TX mode standby")
q.add_log_cmd(f"{prefix}: Set TX mode standby")
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_STANDBY)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCodes.MODULATION:
q.add_log_cmd("syrlinks: Set TX mode modulation")
q.add_log_cmd(f"{prefix}: Set TX mode modulation")
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_MODULATION)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "5":
q.add_log_cmd("syrlinks: Set TX mode CW")
if op_code in OpCodes.SET_CW:
q.add_log_cmd(f"{prefix}: {Info.SET_CW}")
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_CW)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "6":
q.add_log_cmd("Syrlinks: Get RX Registers")
if op_code in OpCodes.HK_RX_REGS:
q.add_log_cmd(f"{prefix}: {Info.HK_RX_REGS}")
sid = make_sid(obyt, SetIds.RX_REGISTERS_DATASET)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "7":
q.add_log_cmd("Syrlinks: Get TX Registers")
if op_code in OpCodes.HK_TX_REGS:
q.add_log_cmd(f"{prefix}: {Info.HK_TX_REGS}")
sid = make_sid(obyt, SetIds.TX_REGISTERS_DATASET)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "8":
q.add_log_cmd("Syrlinks: Read TX status")
if op_code in OpCodes.TX_STATUS:
q.add_log_cmd(f"{prefix}: {Info.TX_STATUS}")
command = obyt + struct.pack("!I", CommandIds.READ_TX_STATUS)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "9":

View File

@ -278,7 +278,13 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
if key not in FACTORY_RESET_OPS:
print("Key invalid!")
break
q.add_pus_tc(make_fsfw_action_cmd(object_id=PLOC_SUPV_ID, action_id=SupvActionIds.FACTORY_RESET, user_data=bytes([key])))
q.add_pus_tc(
make_fsfw_action_cmd(
object_id=PLOC_SUPV_ID,
action_id=SupvActionIds.FACTORY_RESET,
user_data=bytes([key]),
)
)
if op_code == "8":
q.add_log_cmd("PLOC Supervisor: Set max restart tries")
restart_tries = int(input("Specify maximum restart tries: "))