move param cmd to com subsystem
This commit is contained in:
parent
39a9497494
commit
fb6d5eeb80
@ -2,6 +2,7 @@ import enum
|
|||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID
|
from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID
|
||||||
|
from eive_tmtc.tmtc.com.syrlinks_handler import Datarate
|
||||||
from tmtccmd.config.tmtc import (
|
from tmtccmd.config.tmtc import (
|
||||||
tmtc_definitions_provider,
|
tmtc_definitions_provider,
|
||||||
TmtcDefinitionWrapper,
|
TmtcDefinitionWrapper,
|
||||||
@ -10,6 +11,14 @@ from tmtccmd.config.tmtc import (
|
|||||||
from tmtccmd.tc import service_provider
|
from tmtccmd.tc import service_provider
|
||||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||||
from tmtccmd.tc.pus_200_fsfw_modes import create_mode_command
|
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):
|
class Submode(enum.IntEnum):
|
||||||
@ -26,6 +35,8 @@ class OpCode:
|
|||||||
TX_AND_RX_LOW_RATE = "rx_and_tx_low_rate"
|
TX_AND_RX_LOW_RATE = "rx_and_tx_low_rate"
|
||||||
TX_AND_RX_HIGH_RATE = "rx_and_tx_high_rate"
|
TX_AND_RX_HIGH_RATE = "rx_and_tx_high_rate"
|
||||||
TX_AND_RX_CARRIER_WAVE = "rx_and_tx_carrier_wave"
|
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:
|
class Info:
|
||||||
@ -34,12 +45,15 @@ class Info:
|
|||||||
TX_AND_RX_LOW_DATARATE = "Syrlinks with TX low datarate (BPSK modulation)"
|
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_HIGH_DATARATE = "Syrlinks with TX high datarate (0QPSK modulation)"
|
||||||
TX_AND_RX_CARRIER_WAVE = "Syrlinks with TX carrier wave"
|
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)
|
@service_provider(CustomServiceList.COM_SS)
|
||||||
def build_com_subsystem_cmd(p: ServiceProviderParams):
|
def build_com_subsystem_cmd(p: ServiceProviderParams):
|
||||||
q = p.queue_helper
|
q = p.queue_helper
|
||||||
o = p.op_code
|
o = p.op_code
|
||||||
|
prefix = "COM Subsystem"
|
||||||
if o == OpCode.RX_ONLY:
|
if o == OpCode.RX_ONLY:
|
||||||
q.add_log_cmd(Info.RX_ONLY)
|
q.add_log_cmd(Info.RX_ONLY)
|
||||||
q.add_pus_tc(create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_ONLY, 0))
|
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(
|
q.add_pus_tc(
|
||||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_HIGH_DATARATE, 0)
|
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:
|
elif o == OpCode.TX_AND_RX_CARRIER_WAVE:
|
||||||
q.add_log_cmd(Info.TX_AND_RX_CARRIER_WAVE)
|
q.add_log_cmd(Info.TX_AND_RX_CARRIER_WAVE)
|
||||||
q.add_pus_tc(
|
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_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_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.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)
|
defs.add_service(CustomServiceList.COM_SS, "COM Subsystem", oce)
|
||||||
|
@ -24,10 +24,6 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
|||||||
)
|
)
|
||||||
from spacepackets.ecss.tc import PusTelecommand
|
from spacepackets.ecss.tc import PusTelecommand
|
||||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode, create_mode_command
|
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
|
from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
@ -49,8 +45,6 @@ class OpCode:
|
|||||||
NORMAL_RX_AND_TX_DEF_DATARATE = "nml_default_datarate"
|
NORMAL_RX_AND_TX_DEF_DATARATE = "nml_default_datarate"
|
||||||
NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate"
|
NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate"
|
||||||
NORMAL_RX_AND_TX_HIGH_DATARATE = "nml_high_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"
|
HK_RX_REGS = "hk_rx_regs"
|
||||||
ENABLE_HK_RX_REGS = "enable_hk_rx"
|
ENABLE_HK_RX_REGS = "enable_hk_rx"
|
||||||
DISABLE_HK_RX_REGS = "disable_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_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_LOW_DATARATE = "NORMAL RX and TX, TX with low datarate"
|
||||||
NORMAL_RX_AND_TX_HIGH_DATARATE = "NORMAL RX and TX, TX with high 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_RX_REGS = "Request RX register set"
|
||||||
HK_TX_REGS = "Request TX register set"
|
HK_TX_REGS = "Request TX register set"
|
||||||
ENABLE_HK_RX_REGS = "Enable periodic RX register HK"
|
ENABLE_HK_RX_REGS = "Enable periodic RX register HK"
|
||||||
@ -108,10 +100,6 @@ class Submode(enum.IntEnum):
|
|||||||
RX_AND_TX_CW = 4
|
RX_AND_TX_CW = 4
|
||||||
|
|
||||||
|
|
||||||
class ParameterId(enum.IntEnum):
|
|
||||||
DATARATE = 0
|
|
||||||
|
|
||||||
|
|
||||||
class Datarate(enum.IntEnum):
|
class Datarate(enum.IntEnum):
|
||||||
LOW_RATE_MODULATION_BPSK = 0
|
LOW_RATE_MODULATION_BPSK = 0
|
||||||
HIGH_RATE_MODULATION_0QPSK = 1
|
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_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_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.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_RX_REGS, Info.HK_RX_REGS)
|
||||||
oce.add(OpCode.HK_TX_REGS, Info.HK_TX_REGS)
|
oce.add(OpCode.HK_TX_REGS, Info.HK_TX_REGS)
|
||||||
oce.add(OpCode.TX_STATUS, Info.TX_STATUS)
|
oce.add(OpCode.TX_STATUS, Info.TX_STATUS)
|
||||||
@ -188,24 +170,6 @@ def pack_syrlinks_command(
|
|||||||
normal_mode_cmd(
|
normal_mode_cmd(
|
||||||
q, Info.NORMAL_RX_AND_TX_HIGH_DATARATE, Submode.RX_AND_TX_HIGH_DATARATE
|
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:
|
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)
|
normal_mode_cmd(q, Info.NORMAL_RX_AND_TX_CW, Submode.RX_AND_TX_CW)
|
||||||
if op_code in OpCode.HK_RX_REGS:
|
if op_code in OpCode.HK_RX_REGS:
|
||||||
|
Loading…
Reference in New Issue
Block a user