move param cmd to com subsystem

This commit is contained in:
Robin Müller 2023-01-28 14:30:51 +01:00
parent 39a9497494
commit fb6d5eeb80
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 40 additions and 36 deletions

View File

@ -2,6 +2,7 @@ import enum
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID
from eive_tmtc.tmtc.com.syrlinks_handler import Datarate
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
TmtcDefinitionWrapper,
@ -10,6 +11,14 @@ from tmtccmd.config.tmtc import (
from tmtccmd.tc import service_provider
from tmtccmd.tc.decorator import ServiceProviderParams
from tmtccmd.tc.pus_200_fsfw_modes import create_mode_command
from tmtccmd.tc.pus_20_fsfw_params import (
create_load_param_cmd,
pack_scalar_u8_parameter_app_data,
)
class ParameterId(enum.IntEnum):
DATARATE = 0
class Submode(enum.IntEnum):
@ -26,6 +35,8 @@ class OpCode:
TX_AND_RX_LOW_RATE = "rx_and_tx_low_rate"
TX_AND_RX_HIGH_RATE = "rx_and_tx_high_rate"
TX_AND_RX_CARRIER_WAVE = "rx_and_tx_carrier_wave"
UPDATE_DEFAULT_DATARATE_LOW = "update_default_rate_low"
UPDATE_DEFAULT_DATARATE_HIGH = "update_default_rate_high"
class Info:
@ -34,12 +45,15 @@ class Info:
TX_AND_RX_LOW_DATARATE = "Syrlinks with TX low datarate (BPSK modulation)"
TX_AND_RX_HIGH_DATARATE = "Syrlinks with TX high datarate (0QPSK modulation)"
TX_AND_RX_CARRIER_WAVE = "Syrlinks with TX carrier wave"
UPDATE_DEFAULT_DATARATE_LOW = "Configure default low datarate (BPSK modulation)"
UPDATE_DEFAULT_DATARATE_HIGH = "Configure default high datarate (0QPSK modulation)"
@service_provider(CustomServiceList.COM_SS)
def build_com_subsystem_cmd(p: ServiceProviderParams):
q = p.queue_helper
o = p.op_code
prefix = "COM Subsystem"
if o == OpCode.RX_ONLY:
q.add_log_cmd(Info.RX_ONLY)
q.add_pus_tc(create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_ONLY, 0))
@ -58,6 +72,30 @@ def build_com_subsystem_cmd(p: ServiceProviderParams):
q.add_pus_tc(
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_HIGH_DATARATE, 0)
)
if o == OpCode.UPDATE_DEFAULT_DATARATE_LOW:
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW}")
q.add_pus_tc(
create_load_param_cmd(
pack_scalar_u8_parameter_app_data(
COM_SUBSYSTEM_ID,
0,
ParameterId.DATARATE,
Datarate.LOW_RATE_MODULATION_BPSK,
)
)
)
if o == OpCode.UPDATE_DEFAULT_DATARATE_HIGH:
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_HIGH}")
q.add_pus_tc(
create_load_param_cmd(
pack_scalar_u8_parameter_app_data(
COM_SUBSYSTEM_ID,
0,
ParameterId.DATARATE,
Datarate.HIGH_RATE_MODULATION_0QPSK,
)
)
)
elif o == OpCode.TX_AND_RX_CARRIER_WAVE:
q.add_log_cmd(Info.TX_AND_RX_CARRIER_WAVE)
q.add_pus_tc(
@ -72,4 +110,6 @@ def add_com_subsystem_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.TX_AND_RX_LOW_RATE, Info.TX_AND_RX_LOW_DATARATE)
oce.add(OpCode.TX_AND_RX_HIGH_RATE, Info.TX_AND_RX_HIGH_DATARATE)
oce.add(OpCode.TX_AND_RX_DEF_RATE, Info.TX_AND_RX_DEF_DATARATE)
oce.add(OpCode.UPDATE_DEFAULT_DATARATE_LOW, Info.UPDATE_DEFAULT_DATARATE_LOW)
oce.add(OpCode.UPDATE_DEFAULT_DATARATE_HIGH, Info.UPDATE_DEFAULT_DATARATE_HIGH)
defs.add_service(CustomServiceList.COM_SS, "COM Subsystem", oce)

View File

@ -24,10 +24,6 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
)
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.pus_200_fsfw_modes import Mode, create_mode_command
from tmtccmd.tc.pus_20_fsfw_params import (
pack_scalar_u8_parameter_app_data,
create_load_param_cmd,
)
from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
import struct
@ -49,8 +45,6 @@ class OpCode:
NORMAL_RX_AND_TX_DEF_DATARATE = "nml_default_datarate"
NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate"
NORMAL_RX_AND_TX_HIGH_DATARATE = "nml_high_datarate"
UPDATE_DEFAULT_DATARATE_LOW_RATE = "param_low_datarate"
UPDATE_DEFAULT_DATARATE_HIGH_RATE = "param_high_datarate"
HK_RX_REGS = "hk_rx_regs"
ENABLE_HK_RX_REGS = "enable_hk_rx"
DISABLE_HK_RX_REGS = "disable_hk_rx"
@ -69,8 +63,6 @@ class Info:
NORMAL_RX_AND_TX_DEF_DATARATE = "NORMAL RX and TX, TX with default datarate"
NORMAL_RX_AND_TX_LOW_DATARATE = "NORMAL RX and TX, TX with low datarate"
NORMAL_RX_AND_TX_HIGH_DATARATE = "NORMAL RX and TX, TX with high datarate"
UPDATE_DEFAULT_DATARATE_LOW_RATE = "Update default datarate to low rate (BPSK)"
UPDATE_DEFAULT_DATARATE_HIGH_RATE = "Update default datarate to high rate (0QPSK)"
HK_RX_REGS = "Request RX register set"
HK_TX_REGS = "Request TX register set"
ENABLE_HK_RX_REGS = "Enable periodic RX register HK"
@ -108,10 +100,6 @@ class Submode(enum.IntEnum):
RX_AND_TX_CW = 4
class ParameterId(enum.IntEnum):
DATARATE = 0
class Datarate(enum.IntEnum):
LOW_RATE_MODULATION_BPSK = 0
HIGH_RATE_MODULATION_0QPSK = 1
@ -127,12 +115,6 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.NORMAL_RX_AND_TX_DEF_DATARATE, Info.NORMAL_RX_AND_TX_DEF_DATARATE)
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.UPDATE_DEFAULT_DATARATE_LOW_RATE, Info.UPDATE_DEFAULT_DATARATE_LOW_RATE
)
oce.add(
OpCode.UPDATE_DEFAULT_DATARATE_HIGH_RATE, Info.UPDATE_DEFAULT_DATARATE_HIGH_RATE
)
oce.add(OpCode.HK_RX_REGS, Info.HK_RX_REGS)
oce.add(OpCode.HK_TX_REGS, Info.HK_TX_REGS)
oce.add(OpCode.TX_STATUS, Info.TX_STATUS)
@ -188,24 +170,6 @@ def pack_syrlinks_command(
normal_mode_cmd(
q, Info.NORMAL_RX_AND_TX_HIGH_DATARATE, Submode.RX_AND_TX_HIGH_DATARATE
)
if op_code == OpCode.UPDATE_DEFAULT_DATARATE_LOW_RATE:
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW_RATE}")
q.add_pus_tc(
create_load_param_cmd(
pack_scalar_u8_parameter_app_data(
obyt, 0, ParameterId.DATARATE, Datarate.LOW_RATE_MODULATION_BPSK
)
)
)
if op_code == OpCode.UPDATE_DEFAULT_DATARATE_HIGH_RATE:
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_HIGH_RATE}")
q.add_pus_tc(
create_load_param_cmd(
pack_scalar_u8_parameter_app_data(
obyt, 0, ParameterId.DATARATE, Datarate.HIGH_RATE_MODULATION_0QPSK
)
)
)
if op_code in OpCode.NORMAL_RX_AND_TX_CW:
normal_mode_cmd(q, Info.NORMAL_RX_AND_TX_CW, Submode.RX_AND_TX_CW)
if op_code in OpCode.HK_RX_REGS: