2022-11-29 16:53:29 +01:00
|
|
|
from eive_tmtc.config.definitions import CustomServiceList
|
|
|
|
from eive_tmtc.config.object_ids import SUS_BOARD_ASS_ID
|
2023-01-16 14:13:06 +01:00
|
|
|
from eive_tmtc.tmtc.acs.acs_board import DualSideSubmode
|
2022-11-29 16:53:29 +01:00
|
|
|
from eive_tmtc.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-12-01 11:18:11 +01:00
|
|
|
from tmtccmd.tc import service_provider, DefaultPusQueueHelper
|
2022-10-04 14:46:00 +02:00
|
|
|
from tmtccmd.tc.decorator import ServiceProviderParams
|
2023-01-31 12:56:13 +01:00
|
|
|
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
2022-10-04 14:12:33 +02:00
|
|
|
|
|
|
|
|
2023-01-16 14:13:06 +01:00
|
|
|
class SusOpCode:
|
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-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",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-12-01 11:18:11 +01:00
|
|
|
@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)
|
|
|
|
|
|
|
|
|
2022-10-04 14:12:33 +02:00
|
|
|
@tmtc_definitions_provider
|
|
|
|
def add_sus_board_cmds(defs: TmtcDefinitionWrapper):
|
|
|
|
oce = OpCodeEntry()
|
|
|
|
oce.add(
|
2023-01-16 14:13:06 +01:00
|
|
|
keys=SusOpCode.SUS_ASS_NOM_SIDE,
|
2022-10-04 14:12:33 +02:00
|
|
|
info="Switch SUS board to nominal side",
|
|
|
|
)
|
|
|
|
oce.add(
|
2023-01-16 14:13:06 +01:00
|
|
|
keys=SusOpCode.SUS_ASS_RED_SIDE,
|
2022-10-04 14:12:33 +02:00
|
|
|
info="Switch SUS board to redundant side",
|
|
|
|
)
|
|
|
|
oce.add(
|
2023-01-16 14:13:06 +01:00
|
|
|
keys=SusOpCode.SUS_ASS_OFF,
|
2022-10-04 14:12:33 +02:00
|
|
|
info="Switch off SUS board",
|
|
|
|
)
|
|
|
|
oce.add(
|
2023-01-16 14:13:06 +01:00
|
|
|
keys=SusOpCode.SUS_ASS_DUAL_MODE,
|
2022-10-04 14:12:33 +02:00
|
|
|
info="Switch SUS board to dual mode",
|
|
|
|
)
|
|
|
|
defs.add_service(
|
|
|
|
name=CustomServiceList.SUS_BRD_ASS.value,
|
|
|
|
info="SUS Board Assembly",
|
|
|
|
op_code_entry=oce,
|
|
|
|
)
|