eive-tmtc/eive_tmtc/tmtc/tcs/subsystem.py
Robin Mueller ba47757b50
All checks were successful
EIVE/-/pipeline/head This commit looks good
added way to request new HK set
2023-07-10 16:29:54 +02:00

50 lines
1.6 KiB
Python

from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import TCS_SUBSYSTEM_ID
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
from eive_tmtc.tmtc.tcs.brd_assy import pack_tcs_ass_cmds
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
TmtcDefinitionWrapper,
OpCodeEntry,
)
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_200_fsfw_mode import Mode, create_announce_mode_recursive_command
class OpCode:
OFF = "off"
NML = "nml"
ANNOUNCE_MODES = "announce_modes"
class InfoSys:
OFF = "Switch TCS subsystem OFF"
NML = "Switch TCS subsystem NORMAL (nominal)"
ANNOUNCE_MODES = "Announce Modes recursively"
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code == OpCode.OFF:
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:
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:
q.add_log_cmd(InfoSys.ANNOUNCE_MODES)
q.add_pus_tc(create_announce_mode_recursive_command(TCS_SUBSYSTEM_ID))
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)
defs.add_service(
name=CustomServiceList.TCS_SS,
info="TCS subsystem",
op_code_entry=oce,
)