Merge pull request 'more system modes' (#185) from more-system-modes into main

Reviewed-on: #185
This commit is contained in:
Robin Müller 2023-04-28 10:25:35 +02:00
commit 60fba8b6d9

View File

@ -22,6 +22,10 @@ class SystemMode:
BOOT = 5
SAFE = AcsMode.SAFE
IDLE = AcsMode.IDLE
PTG_NADIR = AcsMode.PTG_NADIR
PTG_TARGET = AcsMode.PTG_TARGET
PTG_TARGET_GS = AcsMode.PTG_TARGET_GS
PTG_INERTIAL = AcsMode.PTG_INERTIAL
class ActionId(enum.IntEnum):
@ -32,6 +36,10 @@ class OpCode:
BOOT_MODE = "boot"
SAFE_MODE = "safe"
IDLE_MODE = "idle"
NADIR_MODE = "nadir"
TARGET_MODE = "ptg_target"
TARGET_GS_MODE = "ptg_target_gs"
INERTIAL_MODE = "ptg_inertial"
ANNOUNCE_MODES = "announce_modes"
REBOOT_I2C = "reboot_i2c"
@ -40,6 +48,10 @@ class Info:
BOOT_MODE = "Command System into Boot Mode"
SAFE_MODE = "Command System into Safe Mode"
IDLE_MODE = "Command System into Idle Pointing Mode"
NADIR_MODE = "Command System into Nadir Pointing Mode"
TARGET_MODE = "Command System into Target Pointing Mode"
TARGET_GS_MODE = "Command System into Target Groundstation Pointing Mode"
INERTIAL_MODE = "Command System into Inertial Pointing Mode"
ANNOUNCE_MODES = "Announce mode recursively"
REBOOT_I2C = "Reboot I2C bus"
@ -55,6 +67,18 @@ def build_system_cmds(p: ServiceProviderParams):
elif o == OpCode.IDLE_MODE:
q.add_log_cmd(f"{prefix}: {Info.IDLE_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.IDLE, 0))
elif o == OpCode.NADIR_MODE:
q.add_log_cmd(f"{prefix}: {Info.NADIR_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_NADIR, 0))
elif o == OpCode.TARGET_MODE:
q.add_log_cmd(f"{prefix}: {Info.TARGET_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_TARGET, 0))
elif o == OpCode.TARGET_GS_MODE:
q.add_log_cmd(f"{prefix}: {Info.TARGET_GS_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_TARGET_GS, 0))
elif o == OpCode.INERTIAL_MODE:
q.add_log_cmd(f"{prefix}: {Info.INERTIAL_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_INERTIAL, 0))
elif o == OpCode.ANNOUNCE_MODES:
q.add_log_cmd(f"{prefix}: {Info.ANNOUNCE_MODES}")
q.add_pus_tc(create_announce_mode_recursive_command(EIVE_SYSTEM_ID))
@ -72,6 +96,10 @@ def add_system_cmd_defs(defs: TmtcDefinitionWrapper):
oce.add(keys=OpCode.BOOT_MODE, info=Info.BOOT_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.NADIR_MODE, info=Info.NADIR_MODE)
oce.add(keys=OpCode.TARGET_MODE, info=Info.TARGET_MODE)
oce.add(keys=OpCode.TARGET_GS_MODE, info=Info.TARGET_GS_MODE)
oce.add(keys=OpCode.INERTIAL_MODE, info=Info.INERTIAL_MODE)
oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES)
oce.add(keys=OpCode.REBOOT_I2C, info=Info.REBOOT_I2C)
defs.add_service(