add boot mode command for system

This commit is contained in:
Robin Müller 2023-04-03 15:53:51 +02:00
parent b72dad49a9
commit d7e1a69e75
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -15,13 +15,21 @@ from tmtccmd.tc.pus_200_fsfw_mode import (
from tmtccmd.tc.decorator import ServiceProviderParams from tmtccmd.tc.decorator import ServiceProviderParams
class SystemMode:
BOOT = 5
SAFE = AcsMode.SAFE
IDLE = AcsMode.IDLE
class OpCode: class OpCode:
BOOT_MODE = "boot"
SAFE_MODE = "safe" SAFE_MODE = "safe"
IDLE_MODE = "idle" IDLE_MODE = "idle"
ANNOUNCE_MODES = "announce_modes" ANNOUNCE_MODES = "announce_modes"
class Info: class Info:
BOOT_MODE = "Command System into Boot Mode"
SAFE_MODE = "Command System into Safe Mode" SAFE_MODE = "Command System into Safe Mode"
IDLE_MODE = "Command System into Idle Pointing Mode" IDLE_MODE = "Command System into Idle Pointing Mode"
ANNOUNCE_MODES = "Announce mode recursively" ANNOUNCE_MODES = "Announce mode recursively"
@ -34,18 +42,22 @@ def build_system_cmds(p: ServiceProviderParams):
prefix = "EIVE System" prefix = "EIVE System"
if o == OpCode.SAFE_MODE: if o == OpCode.SAFE_MODE:
q.add_log_cmd(f"{prefix}: {Info.SAFE_MODE}") q.add_log_cmd(f"{prefix}: {Info.SAFE_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, AcsMode.SAFE, 0)) q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.SAFE, 0))
elif o == OpCode.IDLE_MODE: elif o == OpCode.IDLE_MODE:
q.add_log_cmd(f"{prefix}: {Info.IDLE_MODE}") q.add_log_cmd(f"{prefix}: {Info.IDLE_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, AcsMode.IDLE, 0)) q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.IDLE, 0))
elif o == OpCode.ANNOUNCE_MODES: elif o == OpCode.ANNOUNCE_MODES:
q.add_log_cmd(f"{prefix}: {Info.ANNOUNCE_MODES}") q.add_log_cmd(f"{prefix}: {Info.ANNOUNCE_MODES}")
q.add_pus_tc(create_announce_mode_recursive_command(EIVE_SYSTEM_ID)) q.add_pus_tc(create_announce_mode_recursive_command(EIVE_SYSTEM_ID))
elif o == OpCode.BOOT_MODE:
q.add_log_cmd(f"{prefix}: {Info.BOOT_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.BOOT))
@tmtc_definitions_provider @tmtc_definitions_provider
def add_system_cmd_defs(defs: TmtcDefinitionWrapper): def add_system_cmd_defs(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry() oce = OpCodeEntry()
oce.add(keys=OpCode.BOOT_MODE, info=Info.BOOT_MODE)
oce.add(keys=OpCode.SAFE_MODE, info=Info.SAFE_MODE) oce.add(keys=OpCode.SAFE_MODE, info=Info.SAFE_MODE)
oce.add(keys=OpCode.IDLE_MODE, info=Info.IDLE_MODE) oce.add(keys=OpCode.IDLE_MODE, info=Info.IDLE_MODE)
oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES) oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES)