2022-10-04 14:12:33 +02:00
|
|
|
from tmtccmd.config.tmtc import (
|
2023-11-22 14:13:00 +01:00
|
|
|
CmdTreeNode,
|
2022-10-04 14:12:33 +02:00
|
|
|
)
|
2023-11-10 19:23:06 +01:00
|
|
|
from tmtccmd.pus.s200_fsfw_mode import Mode
|
2023-11-22 14:13:00 +01:00
|
|
|
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
|
2022-10-04 14:12:33 +02:00
|
|
|
|
|
|
|
|
2023-01-16 14:13:06 +01:00
|
|
|
class SusOpCode:
|
2023-11-22 14:13:00 +01:00
|
|
|
SUS_ASS_NOM_SIDE = "nom"
|
|
|
|
SUS_ASS_RED_SIDE = "red"
|
|
|
|
SUS_ASS_DUAL_MODE = "dual"
|
|
|
|
SUS_ASS_OFF = "off"
|
2022-10-04 14:12:33 +02:00
|
|
|
|
|
|
|
|
2022-12-01 11:18:11 +01:00
|
|
|
def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str):
|
2023-01-16 14:13:06 +01:00
|
|
|
if op_code in SusOpCode.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,
|
2023-01-16 15:05:33 +01:00
|
|
|
mode=Mode.NORMAL,
|
2023-01-16 14:13:06 +01:00
|
|
|
submode=DualSideSubmode.A_SIDE,
|
2022-10-04 14:12:33 +02:00
|
|
|
q=q,
|
|
|
|
info="Switching to SUS board to nominal side",
|
|
|
|
)
|
2023-01-16 14:13:06 +01:00
|
|
|
if op_code in SusOpCode.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,
|
2023-01-16 15:05:33 +01:00
|
|
|
mode=Mode.NORMAL,
|
2023-01-16 14:13:06 +01:00
|
|
|
submode=DualSideSubmode.B_SIDE,
|
2022-10-04 14:12:33 +02:00
|
|
|
q=q,
|
|
|
|
info="Switching to SUS board to redundant side",
|
|
|
|
)
|
2023-01-16 14:13:06 +01:00
|
|
|
if op_code in SusOpCode.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,
|
2023-01-16 15:05:33 +01:00
|
|
|
mode=Mode.OFF,
|
2022-10-04 14:12:33 +02:00
|
|
|
submode=0,
|
|
|
|
q=q,
|
|
|
|
info="Switching SUS board off",
|
|
|
|
)
|
2023-01-16 14:13:06 +01:00
|
|
|
if op_code in SusOpCode.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,
|
2023-01-16 15:05:33 +01:00
|
|
|
mode=Mode.NORMAL,
|
2023-01-16 14:13:06 +01:00
|
|
|
submode=DualSideSubmode.DUAL_SIDE,
|
2022-10-04 14:12:33 +02:00
|
|
|
q=q,
|
|
|
|
info="Switching to SUS board to dual side",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-11-22 14:13:00 +01:00
|
|
|
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")
|
2022-10-04 14:12:33 +02:00
|
|
|
)
|
2023-11-22 14:13:00 +01:00
|
|
|
node.add_child(
|
|
|
|
CmdTreeNode(SusOpCode.SUS_ASS_RED_SIDE, "Switch SUS board to redundant side")
|
2022-10-04 14:12:33 +02:00
|
|
|
)
|
2023-11-22 14:13:00 +01:00
|
|
|
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")
|
2022-10-04 14:12:33 +02:00
|
|
|
)
|
2023-11-22 14:13:00 +01:00
|
|
|
return node
|