diff --git a/eive_tmtc/tmtc/__init__.py b/eive_tmtc/tmtc/__init__.py index 84ed9c4..7385d19 100644 --- a/eive_tmtc/tmtc/__init__.py +++ b/eive_tmtc/tmtc/__init__.py @@ -1,4 +1,3 @@ -from .solar_array_deployment import add_sa_depl_cmds from .system import add_system_cmd_defs from .tm_store import add_persistent_tm_store_cmd_defs from .tcs import add_tmp_sens_cmds diff --git a/eive_tmtc/tmtc/acs/acs_board.py b/eive_tmtc/tmtc/acs/acs_board.py index 5d1d41b..7ac7bcc 100644 --- a/eive_tmtc/tmtc/acs/acs_board.py +++ b/eive_tmtc/tmtc/acs/acs_board.py @@ -1,16 +1,15 @@ import enum -from eive_tmtc.config.definitions import CustomServiceList from tmtccmd.config.tmtc import ( - tmtc_definitions_provider, - TmtcDefinitionWrapper, OpCodeEntry, + TmtcDefinitionWrapper, + tmtc_definitions_provider, ) -from tmtccmd.tmtc import service_provider, DefaultPusQueueHelper -from tmtccmd.tmtc.decorator import ServiceProviderParams from tmtccmd.pus.s200_fsfw_mode import Mode -from eive_tmtc.config.object_ids import ACS_BOARD_ASS_ID +from tmtccmd.tmtc import DefaultPusQueueHelper +from eive_tmtc.config.definitions import CustomServiceList +from eive_tmtc.config.object_ids import ACS_BOARD_ASS_ID from eive_tmtc.tmtc.common import pack_mode_cmd_with_info @@ -89,13 +88,6 @@ def pack_acs_command(q: DefaultPusQueueHelper, cmd_str: str): ) -@service_provider(CustomServiceList.ACS_BRD_ASS) -def pack_acs_command_provider(p: ServiceProviderParams): - op_code = p.op_code - q = p.queue_helper - pack_acs_command(q, op_code) - - @tmtc_definitions_provider def add_acs_board_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() diff --git a/eive_tmtc/tmtc/acs/sus_board.py b/eive_tmtc/tmtc/acs/sus_board.py index cc419a4..18dbcb4 100644 --- a/eive_tmtc/tmtc/acs/sus_board.py +++ b/eive_tmtc/tmtc/acs/sus_board.py @@ -1,22 +1,19 @@ -from eive_tmtc.config.definitions import CustomServiceList +from tmtccmd.config.tmtc import ( + CmdTreeNode, +) +from tmtccmd.pus.s200_fsfw_mode import Mode +from tmtccmd.tmtc import DefaultPusQueueHelper + from eive_tmtc.config.object_ids import SUS_BOARD_ASS_ID from eive_tmtc.tmtc.acs.acs_board import DualSideSubmode from eive_tmtc.tmtc.common import pack_mode_cmd_with_info -from tmtccmd.config.tmtc import ( - tmtc_definitions_provider, - TmtcDefinitionWrapper, - OpCodeEntry, -) -from tmtccmd.tmtc import service_provider, DefaultPusQueueHelper -from tmtccmd.tmtc.decorator import ServiceProviderParams -from tmtccmd.pus.s200_fsfw_mode import Mode class SusOpCode: - SUS_ASS_NOM_SIDE = ["0", "nom"] - SUS_ASS_RED_SIDE = ["1", "red"] - SUS_ASS_DUAL_MODE = ["2", "dual"] - SUS_ASS_OFF = ["3", "off"] + SUS_ASS_NOM_SIDE = "nom" + SUS_ASS_RED_SIDE = "red" + SUS_ASS_DUAL_MODE = "dual" + SUS_ASS_OFF = "off" def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str): @@ -54,34 +51,16 @@ def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str): ) -@service_provider(CustomServiceList.SUS_BRD_ASS) -def pack_sus_cmds_prvoider(p: ServiceProviderParams): - op_code = p.op_code - q = p.queue_helper - pack_sus_cmds(q, op_code) - - -@tmtc_definitions_provider -def add_sus_board_cmds(defs: TmtcDefinitionWrapper): - oce = OpCodeEntry() - oce.add( - keys=SusOpCode.SUS_ASS_NOM_SIDE, - info="Switch SUS board to nominal side", +def create_sus_board_node() -> CmdTreeNode: + node = CmdTreeNode("sus_brd_assy", "SUS board assembly") + node.add_child( + CmdTreeNode(SusOpCode.SUS_ASS_RED_SIDE, "Switch SUS board to nominal side") ) - oce.add( - keys=SusOpCode.SUS_ASS_RED_SIDE, - info="Switch SUS board to redundant side", + node.add_child( + CmdTreeNode(SusOpCode.SUS_ASS_RED_SIDE, "Switch SUS board to redundant side") ) - oce.add( - keys=SusOpCode.SUS_ASS_OFF, - info="Switch off SUS board", - ) - oce.add( - keys=SusOpCode.SUS_ASS_DUAL_MODE, - info="Switch SUS board to dual mode", - ) - defs.add_service( - name=CustomServiceList.SUS_BRD_ASS.value, - info="SUS Board Assembly", - op_code_entry=oce, + node.add_child(CmdTreeNode(SusOpCode.SUS_ASS_OFF, "Switch SUS board off")) + node.add_child( + CmdTreeNode(SusOpCode.SUS_ASS_DUAL_MODE, "Switch SUS board to dual mode") ) + return node diff --git a/eive_tmtc/tmtc/solar_array_deployment.py b/eive_tmtc/tmtc/solar_array_deployment.py index 201a48c..c0858b7 100644 --- a/eive_tmtc/tmtc/solar_array_deployment.py +++ b/eive_tmtc/tmtc/solar_array_deployment.py @@ -9,17 +9,14 @@ import logging import struct -from eive_tmtc.config.definitions import CustomServiceList -from eive_tmtc.config.object_ids import SOLAR_ARRAY_DEPLOYMENT_ID from spacepackets.ecss import PusTelecommand from tmtccmd.config.tmtc import ( - tmtc_definitions_provider, - TmtcDefinitionWrapper, - OpCodeEntry, + CmdTreeNode, ) -from tmtccmd.tmtc import service_provider, DefaultPusQueueHelper from tmtccmd.pus.s8_fsfw_action import create_action_cmd -from tmtccmd.tmtc.decorator import ServiceProviderParams +from tmtccmd.tmtc import DefaultPusQueueHelper + +from eive_tmtc.config.object_ids import SOLAR_ARRAY_DEPLOYMENT_ID class OpCode: @@ -38,25 +35,17 @@ class ActionId: MANUAL_DEPLOYMENT = 5 -@tmtc_definitions_provider -def add_sa_depl_cmds(defs: TmtcDefinitionWrapper): - oce = OpCodeEntry() - oce.add(keys=OpCode.MANUAL_DEPLOYMENT, info=Info.MANUAL_DEPLOYMENT) - oce.add(keys=OpCode.BURN_SA_0_ONLY, info=Info.BURN_SA_0_ONLY) - oce.add(keys=OpCode.BURN_SA_1_ONLY, info=Info.BURN_SA_1_ONLY) - defs.add_service( - name=CustomServiceList.SA_DEPLYOMENT, - info="Solar Array Deployment", - op_code_entry=oce, - ) +def add_solar_array_deployment_node() -> CmdTreeNode: + node = CmdTreeNode("solar_array_deployment", "Solar Array Deployment") + node.add_child(CmdTreeNode(OpCode.MANUAL_DEPLOYMENT, Info.MANUAL_DEPLOYMENT)) + node.add_child(CmdTreeNode(OpCode.BURN_SA_0_ONLY, Info.BURN_SA_0_ONLY)) + node.add_child(CmdTreeNode(OpCode.BURN_SA_1_ONLY, Info.BURN_SA_1_ONLY)) + return node -@service_provider(CustomServiceList.SA_DEPLYOMENT) -def pack_solar_array_deployment_test_into(p: ServiceProviderParams): - q = p.queue_helper - op_code = p.op_code +def pack_solar_array_deployment_test_into(q: DefaultPusQueueHelper, cmd_str: str): switch_interval_ms = 0 - if op_code == OpCode.MANUAL_DEPLOYMENT: + if cmd_str == OpCode.MANUAL_DEPLOYMENT: while True: burn_time_secs = prompt_burn_time() if burn_time_secs < 0: @@ -80,9 +69,9 @@ def pack_solar_array_deployment_test_into(p: ServiceProviderParams): q.add_pus_tc( pack_manual_array_depl_cmd(burn_time_secs, switch_interval_ms, dry_run) ) - elif op_code in OpCode.BURN_SA_0_ONLY: + elif cmd_str == OpCode.BURN_SA_0_ONLY: burn_one_channel_only(q, 0) - elif op_code in OpCode.BURN_SA_1_ONLY: + elif cmd_str == OpCode.BURN_SA_1_ONLY: burn_one_channel_only(q, 1)