add commands to update default data rate

This commit is contained in:
Robin Müller 2023-01-26 14:34:21 +01:00
parent ffdc6a68bb
commit 2ac182e753
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 33 additions and 4 deletions

View File

@ -17,6 +17,7 @@ list yields a list of all related PRs for each release.
## Added
- Added command to request switcher set from PCDU handler.
- Star Tracker: Add commands to update default datarate.
## Changed

View File

@ -24,7 +24,10 @@ 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 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
@ -46,7 +49,8 @@ class OpCode:
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"
UPDATE_DEFAULT_DATARATE = "update_default_datarate"
UPDATE_DEFAULT_DATARATE_LOW_RATE = "update_default_datarate_low_rate"
UPDATE_DEFAULT_DATARATE_HIGH_RATE = "update_default_datarate_high_rate"
HK_RX_REGS = "hk_rx_regs"
ENABLE_HK_RX_REGS = "enable_hk_rx"
DISABLE_HK_RX_REGS = "disable_hk_rx"
@ -66,7 +70,8 @@ class Info:
NORMAL_RX_AND_TX_DEFAULT_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 = "Update default 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"
@ -104,6 +109,10 @@ 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
@ -119,7 +128,12 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
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.UPDATE_DEFAULT_DATARATE, Info.UPDATE_DEFAULT_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)
@ -169,6 +183,20 @@ def pack_syrlinks_command(
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 == OpCode.UPDATE_DEFAULT_DATARATE_LOW_RATE:
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW_RATE}")
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}")
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, Submode.RX_AND_TX_CW)
if op_code in OpCode.HK_RX_REGS: