eive-tmtc/tmtc/acs/sus_board.py

84 lines
2.4 KiB
Python
Raw Normal View History

2022-10-04 14:12:33 +02:00
from config.definitions import CustomServiceList
from config.object_ids import SUS_BOARD_ASS_ID
2022-11-03 22:04:21 +01:00
from tmtc.acs.acs_board import DualSideSubmodes
2022-10-04 14:46:00 +02:00
from tmtc.common import pack_mode_cmd_with_info
2022-10-04 14:12:33 +02:00
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
TmtcDefinitionWrapper,
OpCodeEntry,
)
2022-10-04 14:46:00 +02:00
from tmtccmd.tc import service_provider
from tmtccmd.tc.decorator import ServiceProviderParams
2022-10-04 14:12:33 +02:00
from tmtccmd.tc.pus_200_fsfw_modes import Modes
class SusOpCodes:
2022-10-04 14:46:00 +02:00
SUS_ASS_NOM_SIDE = ["0", "nom"]
SUS_ASS_RED_SIDE = ["1", "red"]
SUS_ASS_DUAL_MODE = ["2", "dual"]
SUS_ASS_OFF = ["3", "off"]
2022-10-04 14:12:33 +02:00
2022-10-04 14:46:00 +02:00
@service_provider(CustomServiceList.SUS_BRD_ASS)
def pack_sus_cmds(p: ServiceProviderParams):
op_code = p.op_code
q = p.queue_helper
2022-10-04 14:12:33 +02:00
if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
2022-10-04 14:46:00 +02:00
pack_mode_cmd_with_info(
2022-10-04 14:12:33 +02:00
object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE,
q=q,
info="Switching to SUS board to nominal side",
)
if op_code in SusOpCodes.SUS_ASS_RED_SIDE:
2022-10-04 14:46:00 +02:00
pack_mode_cmd_with_info(
2022-10-04 14:12:33 +02:00
object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE,
q=q,
info="Switching to SUS board to redundant side",
)
if op_code in SusOpCodes.SUS_ASS_OFF:
2022-10-04 14:46:00 +02:00
pack_mode_cmd_with_info(
2022-10-04 14:12:33 +02:00
object_id=SUS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
q=q,
info="Switching SUS board off",
)
if op_code in SusOpCodes.SUS_ASS_DUAL_MODE:
2022-10-04 14:46:00 +02:00
pack_mode_cmd_with_info(
2022-10-04 14:12:33 +02:00
object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE,
q=q,
info="Switching to SUS board to dual side",
)
@tmtc_definitions_provider
def add_sus_board_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(
keys=SusOpCodes.SUS_ASS_NOM_SIDE,
info="Switch SUS board to nominal side",
)
oce.add(
keys=SusOpCodes.SUS_ASS_RED_SIDE,
info="Switch SUS board to redundant side",
)
oce.add(
keys=SusOpCodes.SUS_ASS_OFF,
info="Switch off SUS board",
)
oce.add(
keys=SusOpCodes.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,
)