eive-tmtc/eive_tmtc/tmtc/tcs/subsystem.py

50 lines
1.6 KiB
Python
Raw Normal View History

2023-01-31 15:41:51 +01:00
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import TCS_SUBSYSTEM_ID
2023-01-31 15:41:51 +01:00
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
2023-01-31 15:44:09 +01:00
from eive_tmtc.tmtc.tcs.brd_assy import pack_tcs_ass_cmds
2023-01-31 15:41:51 +01:00
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
TmtcDefinitionWrapper,
OpCodeEntry,
)
2023-11-10 19:23:06 +01:00
from tmtccmd.tmtc import DefaultPusQueueHelper
from tmtccmd.pus.s200_fsfw_mode import Mode, create_announce_mode_recursive_command
2023-01-31 15:41:51 +01:00
class OpCode:
OFF = "off"
NML = "nml"
2023-02-21 01:30:24 +01:00
ANNOUNCE_MODES = "announce_modes"
2023-01-31 15:41:51 +01:00
class InfoSys:
OFF = "Switch TCS subsystem OFF"
NML = "Switch TCS subsystem NORMAL (nominal)"
2023-02-21 01:30:24 +01:00
ANNOUNCE_MODES = "Announce Modes recursively"
2023-01-31 15:41:51 +01:00
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code == OpCode.OFF:
2023-01-31 15:41:51 +01:00
q.add_log_cmd(InfoSys.OFF)
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.OFF, 0, q, InfoSys.OFF)
if op_code == OpCode.NML:
2023-01-31 15:41:51 +01:00
q.add_log_cmd(InfoSys.NML)
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
if op_code == OpCode.ANNOUNCE_MODES:
2023-02-21 01:30:24 +01:00
q.add_log_cmd(InfoSys.ANNOUNCE_MODES)
q.add_pus_tc(create_announce_mode_recursive_command(TCS_SUBSYSTEM_ID))
2023-01-31 15:41:51 +01:00
pack_tcs_ass_cmds(q, op_code)
@tmtc_definitions_provider
def add_tcs_subsystem_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=OpCode.OFF, info=InfoSys.OFF)
oce.add(keys=OpCode.NML, info=InfoSys.NML)
oce.add(keys=OpCode.ANNOUNCE_MODES, info=InfoSys.ANNOUNCE_MODES)
2023-01-31 15:41:51 +01:00
defs.add_service(
name=CustomServiceList.TCS_SS,
info="TCS subsystem",
2023-01-31 15:41:51 +01:00
op_code_entry=oce,
)