diff --git a/eive_tmtc/config/definitions.py b/eive_tmtc/config/definitions.py index 30836fd..d5c3bc3 100644 --- a/eive_tmtc/config/definitions.py +++ b/eive_tmtc/config/definitions.py @@ -35,6 +35,7 @@ class CustomServiceList(str, enum.Enum): POWER = "power" ACU = "acu" ACS = "acs" + COM_SS = "com" BPX_BATTERY = "bpx" TMP1075_1 = "tmp1075_1" TMP1075_2 = "tmp1075_2" diff --git a/eive_tmtc/config/object_ids.py b/eive_tmtc/config/object_ids.py index 2e74d13..31d3ac5 100644 --- a/eive_tmtc/config/object_ids.py +++ b/eive_tmtc/config/object_ids.py @@ -127,6 +127,8 @@ SUS_11_R_LOC_XBYMZB_PT_ZB = bytes([0x44, 0x12, 0x00, 0x43]) ACS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x01]) PL_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x02]) TCS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x03]) +COM_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x04]) + ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01]) SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02]) TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03]) diff --git a/eive_tmtc/pus_tm/event_handler.py b/eive_tmtc/pus_tm/event_handler.py index ba2baab..fada99d 100644 --- a/eive_tmtc/pus_tm/event_handler.py +++ b/eive_tmtc/pus_tm/event_handler.py @@ -4,7 +4,7 @@ from eive_tmtc.config.events import get_event_dict from eive_tmtc.config.object_ids import get_object_ids from eive_tmtc.pus_tm.defs import PrintWrapper from eive_tmtc.pus_tm.verification_handler import generic_retval_printout -from eive_tmtc.tmtc.acs.acs_subsystem import AcsMode +from eive_tmtc.tmtc.acs.subsystem import AcsMode from tmtccmd.tc.pus_200_fsfw_modes import Mode from tmtccmd.tm import Service5Tm diff --git a/eive_tmtc/tmtc/__init__.py b/eive_tmtc/tmtc/__init__.py index d78d994..74fd153 100644 --- a/eive_tmtc/tmtc/__init__.py +++ b/eive_tmtc/tmtc/__init__.py @@ -1,3 +1,3 @@ -from .payload.pl_subsystem import add_payload_subsystem_cmds +from .payload.subsystem import add_payload_subsystem_cmds from .solar_array_deployment import add_sa_depl_cmds from .test import add_test_defs diff --git a/eive_tmtc/tmtc/acs/acs_subsystem.py b/eive_tmtc/tmtc/acs/subsystem.py similarity index 100% rename from eive_tmtc/tmtc/acs/acs_subsystem.py rename to eive_tmtc/tmtc/acs/subsystem.py diff --git a/eive_tmtc/tmtc/com/__init__.py b/eive_tmtc/tmtc/com/__init__.py index e69de29..b70bd5c 100644 --- a/eive_tmtc/tmtc/com/__init__.py +++ b/eive_tmtc/tmtc/com/__init__.py @@ -0,0 +1 @@ +from .subsystem import add_com_subsystem_cmds diff --git a/eive_tmtc/tmtc/com/subsystem.py b/eive_tmtc/tmtc/com/subsystem.py new file mode 100644 index 0000000..3f73dac --- /dev/null +++ b/eive_tmtc/tmtc/com/subsystem.py @@ -0,0 +1,67 @@ +import enum + +from eive_tmtc.config.definitions import CustomServiceList +from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID +from tmtccmd.config.tmtc import ( + tmtc_definitions_provider, + TmtcDefinitionWrapper, + OpCodeEntry, +) +from tmtccmd.tc import service_provider +from tmtccmd.tc.decorator import ServiceProviderParams +from tmtccmd.tc.pus_200_fsfw_modes import create_mode_command + + +class Submode(enum.IntEnum): + RX_ONLY = 0 + RX_AND_TX_DEF_DATARATE = 1 + RX_AND_TX_LOW_DATARATE = 2 + RX_AND_TX_HIGH_DATARATE = 3 + RX_AND_TX_CARRIER_WAVE = 4 + + +class OpCode: + RX_ONLY = "rx_only" + 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" + + +class Info: + RX_ONLY = "Syrlinks RX Only" + 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" + + +@service_provider(CustomServiceList.COM_SS) +def build_com_subsystem_cmd(p: ServiceProviderParams): + q = p.queue_helper + o = p.op_code + 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)) + 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) + ) + 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) + ) + 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) + ) + + +@tmtc_definitions_provider +def add_com_subsystem_cmds(defs: TmtcDefinitionWrapper): + oce = OpCodeEntry() + oce.add(OpCode.RX_ONLY, Info.RX_ONLY) + 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) + defs.add_service(CustomServiceList.COM_SS, "COM Subsystem", oce) diff --git a/eive_tmtc/tmtc/payload/pl_subsystem.py b/eive_tmtc/tmtc/payload/subsystem.py similarity index 100% rename from eive_tmtc/tmtc/payload/pl_subsystem.py rename to eive_tmtc/tmtc/payload/subsystem.py