clean up this mess

This commit is contained in:
Robin Müller 2023-03-26 20:00:34 +02:00
parent 3d25a30a11
commit 4b5c4fecc7
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 30 additions and 21 deletions

View File

@ -10,6 +10,11 @@ list yields a list of all related PRs for each release.
# [unreleased]
## Changed
- COM `Submode` enum moved from subsystem module to separate definitions module and renamed
to `Mode`. Added re-imports with the name `ComMode` in the subsystem and syrlinks module.
# [v2.19.4] 2023-03-24
## Fixed

View File

@ -0,0 +1,9 @@
import enum
class Mode(enum.IntEnum):
RX_ONLY = 10
RX_AND_TX_DEF_DATARATE = 11
RX_AND_TX_LOW_DATARATE = 12
RX_AND_TX_HIGH_DATARATE = 13
RX_AND_TX_CARRIER_WAVE = 14

View File

@ -3,6 +3,9 @@ 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 .defs import Mode as ComMode
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
TmtcDefinitionWrapper,
@ -29,14 +32,6 @@ class ParameterId(enum.IntEnum):
TRANSMITTER_TIMEOUT = 1
class Submode(enum.IntEnum):
RX_ONLY = 10
RX_AND_TX_DEF_DATARATE = 11
RX_AND_TX_LOW_DATARATE = 12
RX_AND_TX_HIGH_DATARATE = 13
RX_AND_TX_CARRIER_WAVE = 14
class OpCode:
RX_ONLY = "rx_only"
TX_AND_RX_DEF_RATE = "rx_and_tx_default_rate"
@ -72,21 +67,21 @@ def build_com_subsystem_cmd(p: ServiceProviderParams):
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))
q.add_pus_tc(create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_ONLY, 0))
elif o == OpCode.TX_AND_RX_DEF_RATE:
q.add_log_cmd(Info.TX_AND_RX_DEF_DATARATE)
q.add_pus_tc(
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_DEF_DATARATE, 0)
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_DEF_DATARATE, 0)
)
elif o == OpCode.TX_AND_RX_LOW_RATE:
q.add_log_cmd(Info.TX_AND_RX_LOW_DATARATE)
q.add_pus_tc(
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_LOW_DATARATE, 0)
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_LOW_DATARATE, 0)
)
elif o == OpCode.TX_AND_RX_HIGH_RATE:
q.add_log_cmd(Info.TX_AND_RX_HIGH_DATARATE)
q.add_pus_tc(
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_HIGH_DATARATE, 0)
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_HIGH_DATARATE, 0)
)
if o == OpCode.UPDATE_DEFAULT_DATARATE_LOW:
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW}")
@ -115,7 +110,7 @@ def build_com_subsystem_cmd(p: ServiceProviderParams):
elif o == OpCode.TX_AND_RX_CARRIER_WAVE:
q.add_log_cmd(Info.TX_AND_RX_CARRIER_WAVE)
q.add_pus_tc(
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_CARRIER_WAVE, 0)
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_CARRIER_WAVE, 0)
)
elif o == OpCode.CHANGE_TRANSMITTER_TIMEOUT:
timeout = int(input("Specify timeout to set [ms]: "))

View File

@ -10,7 +10,7 @@ import logging
import math
from eive_tmtc.pus_tm.defs import PrintWrapper
from eive_tmtc.tmtc.com.subsystem import Submode
from eive_tmtc.tmtc.com.defs import Mode as ComMode
from eive_tmtc.config.definitions import CustomServiceList
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
@ -155,21 +155,21 @@ def pack_syrlinks_command(
q.add_log_cmd(f"{prefix}: {Info.ON}")
q.add_pus_tc(create_mode_command(obyt, Mode.ON, 0))
if op_code == OpCode.NORMAL_RX_ONLY:
normal_mode_cmd(q, Info.NORMAL_RX_ONLY, Submode.RX_ONLY)
normal_mode_cmd(q, Info.NORMAL_RX_ONLY, ComMode.RX_ONLY)
if op_code == OpCode.NORMAL_RX_AND_TX_LOW_DATARATE:
normal_mode_cmd(
q, Info.NORMAL_RX_AND_TX_LOW_DATARATE, Submode.RX_AND_TX_LOW_DATARATE
q, Info.NORMAL_RX_AND_TX_LOW_DATARATE, ComMode.RX_AND_TX_LOW_DATARATE
)
if op_code == OpCode.NORMAL_RX_AND_TX_DEF_DATARATE:
normal_mode_cmd(
q, Info.NORMAL_RX_AND_TX_DEF_DATARATE, Submode.RX_AND_TX_DEFAULT_DATARATE
q, Info.NORMAL_RX_AND_TX_DEF_DATARATE, ComMode.RX_AND_TX_DEF_DATARATE
)
if op_code == OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE:
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, ComMode.RX_AND_TX_HIGH_DATARATE
)
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, ComMode.RX_AND_TX_CARRIER_WAVE)
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)

View File

@ -8,7 +8,7 @@ from eive_tmtc.config.object_ids import (
RW_ASSEMBLY,
SUS_BOARD_ASS_ID,
MGM_0_LIS3_HANDLER_ID,
MGM_1_RM3100_HANDLER_ID
MGM_1_RM3100_HANDLER_ID,
)
SUBSYSTEM_DICT = {
@ -26,7 +26,7 @@ ACS_OBJ_DICT = {
5: ("GYR 0 ADIS", GYRO_0_ADIS_HANDLER_ID),
6: ("GYR 1 L3G", GYRO_1_L3G_HANDLER_ID),
7: ("MGM 0 LIS3", MGM_0_LIS3_HANDLER_ID),
8: ("MGM 1 RM3100", MGM_1_RM3100_HANDLER_ID)
8: ("MGM 1 RM3100", MGM_1_RM3100_HANDLER_ID),
}