update syrlinks commands
This commit is contained in:
parent
c36c7ca5bb
commit
8a5e779e23
@ -23,7 +23,8 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
create_disable_periodic_hk_command,
|
||||
)
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode, create_mode_command
|
||||
from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
|
||||
import struct
|
||||
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
@ -40,9 +41,10 @@ class OpCode:
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
NORMAL = "nml"
|
||||
STANDBY = "set_tx_standby"
|
||||
SET_TX_CW = "set_tx_carrier_wave"
|
||||
SET_TX_MODULATION = "set_tx_modulation"
|
||||
NORMAL_RX_ONLY = "nml_rx_only"
|
||||
NORMAL_RX_AND_TX_CW = "nml_carrier_wave"
|
||||
NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate"
|
||||
NORMAL_RX_AND_TX_HIGH_DATARATE = "nml_high_datarate"
|
||||
HK_RX_REGS = "hk_rx_regs"
|
||||
ENABLE_HK_RX_REGS = "enable_hk_rx"
|
||||
DISABLE_HK_RX_REGS = "disable_hk_rx"
|
||||
@ -54,6 +56,13 @@ class OpCode:
|
||||
|
||||
|
||||
class Info:
|
||||
OFF = "Switch OFF"
|
||||
ON = "Switch ON"
|
||||
NORMAL = "Switch NORMAL"
|
||||
NORMAL_RX_ONLY = "NORMAL RX Only, set TX to standby"
|
||||
NORMAL_RX_AND_TX_CW = "nml_carrier_wave"
|
||||
NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate"
|
||||
NORMAL_RX_AND_TX_HIGH_DATARATE = "nml_high_datarate"
|
||||
HK_RX_REGS = "Request RX register set"
|
||||
HK_TX_REGS = "Request TX register set"
|
||||
ENABLE_HK_RX_REGS = "Enable periodic RX register HK"
|
||||
@ -83,17 +92,31 @@ class CommandId(enum.IntEnum):
|
||||
DISABLE_DEBUG = 21
|
||||
|
||||
|
||||
class Submode(enum.IntEnum):
|
||||
DEFAULT = 0
|
||||
RX_ONLY = 1
|
||||
RX_AND_TX_LOW_DATARATE = 2
|
||||
RX_AND_TX_HIGH_DATARATE = 3
|
||||
RX_AND_TX_CW = 4
|
||||
|
||||
|
||||
class Datarate(enum.Enum):
|
||||
LOW_RATE_MODULATION_BPSK = (0,)
|
||||
HIGH_RATE_MODULATION_0QPSK = 1
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.OFF, "Syrlinks Handler: Set mode off")
|
||||
oce.add(OpCode.ON, "Syrlinks Handler: Set mode on")
|
||||
oce.add(OpCode.NORMAL, "Syrlinks Handler: Set mode normal")
|
||||
oce.add(OpCode.STANDBY, "Syrlinks Handler: Set TX standby")
|
||||
oce.add(OpCode.SET_TX_MODULATION, "Syrlinks Handler: Set TX modulation")
|
||||
oce.add(OpCode.OFF, Info.OFF)
|
||||
oce.add(OpCode.ON, Info.ON)
|
||||
oce.add(OpCode.NORMAL, Info.NORMAL)
|
||||
oce.add(OpCode.NORMAL_RX_ONLY, Info.NORMAL_RX_ONLY)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_CW, Info.NORMAL_RX_AND_TX_CW)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_LOW_DATARATE, Info.NORMAL_RX_AND_TX_LOW_DATARATE)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE, Info.NORMAL_RX_AND_TX_HIGH_DATARATE)
|
||||
oce.add(OpCode.HK_RX_REGS, Info.HK_RX_REGS)
|
||||
oce.add(OpCode.HK_TX_REGS, Info.HK_TX_REGS)
|
||||
oce.add(OpCode.SET_TX_CW, Info.SET_CW)
|
||||
oce.add(OpCode.TX_STATUS, Info.TX_STATUS)
|
||||
oce.add(OpCode.RX_STATUS, Info.RX_STATUS)
|
||||
oce.add(OpCode.ENABLE_HK_RX_REGS, Info.ENABLE_HK_RX_REGS)
|
||||
@ -113,6 +136,14 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
|
||||
defs.add_service(CustomServiceList.SYRLINKS.value, "Syrlinks Handler", oce)
|
||||
|
||||
|
||||
_PREFIX = "Syrlinks"
|
||||
|
||||
|
||||
def normal_mode_cmd(q: DefaultPusQueueHelper, info: str, submode: int):
|
||||
q.add_log_cmd(f"{_PREFIX}: {info}")
|
||||
q.add_pus_tc(create_mode_command(SYRLINKS_HANDLER_ID, Mode.NORMAL, submode))
|
||||
|
||||
|
||||
def pack_syrlinks_command(
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
@ -120,29 +151,23 @@ def pack_syrlinks_command(
|
||||
prefix = "Syrlinks"
|
||||
q.add_log_cmd(f"Testing Syrlinks with object id: {object_id.as_hex_string}")
|
||||
if op_code == OpCode.OFF:
|
||||
q.add_log_cmd(f"{prefix}: Set mode off")
|
||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||
data = pack_mode_data(obyt, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCode.ON:
|
||||
q.add_log_cmd(f"{prefix}: Set mode on")
|
||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||
data = pack_mode_data(obyt, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCode.NORMAL:
|
||||
q.add_log_cmd(f"{prefix}: Mode Normal")
|
||||
data = pack_mode_data(obyt, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCode.STANDBY:
|
||||
q.add_log_cmd(f"{prefix}: Set TX mode standby")
|
||||
data = obyt + struct.pack("!I", CommandId.SET_TX_MODE_STANDBY)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCode.SET_TX_MODULATION:
|
||||
q.add_log_cmd(f"{prefix}: Set TX mode modulation")
|
||||
data = obyt + struct.pack("!I", CommandId.SET_TX_MODE_MODULATION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code in OpCode.SET_TX_CW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.SET_CW}")
|
||||
data = obyt + struct.pack("!I", CommandId.SET_TX_MODE_CW)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
normal_mode_cmd(q, Info.NORMAL, Submode.DEFAULT)
|
||||
if op_code == OpCode.NORMAL_RX_ONLY:
|
||||
normal_mode_cmd(q, Info.NORMAL, Submode.RX_ONLY)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_LOW_DATARATE:
|
||||
normal_mode_cmd(q, Info.NORMAL, Submode.RX_AND_TX_LOW_DATARATE)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE:
|
||||
normal_mode_cmd(q, Info.NORMAL, Submode.RX_AND_TX_HIGH_DATARATE)
|
||||
if op_code in OpCode.NORMAL_RX_AND_TX_CW:
|
||||
normal_mode_cmd(q, Info.NORMAL, Submode.RX_AND_TX_CW)
|
||||
if op_code in OpCode.HK_RX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_RX_REGS}")
|
||||
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
|
||||
@ -279,7 +304,7 @@ def handle_syrlinks_tx_registers_dataset(
|
||||
header_list = ["TX Status", "TX Waveform", "TX AGC value"]
|
||||
tx_status = hk_data[0]
|
||||
tx_waveform = hk_data[1]
|
||||
tx_agc_value = struct.unpack("!H", hk_data[2:4])
|
||||
tx_agc_value = struct.unpack("!H", hk_data[2:4])[0]
|
||||
content_list = [tx_status, tx_waveform, tx_agc_value]
|
||||
validity_buffer = hk_data[4:]
|
||||
for header, content in zip(header_list, content_list):
|
||||
|
Loading…
Reference in New Issue
Block a user