add i2c reboot cmd

This commit is contained in:
Robin Müller 2023-04-06 22:25:38 +02:00
parent 7e5fa2e61a
commit ad08276079
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -1,3 +1,5 @@
import enum
from eive_tmtc.config.definitions import CustomServiceList from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.tmtc.acs.subsystem import AcsMode from eive_tmtc.tmtc.acs.subsystem import AcsMode
from tmtccmd.config.tmtc import ( from tmtccmd.config.tmtc import (
@ -12,6 +14,7 @@ from tmtccmd.tc.pus_200_fsfw_mode import (
Mode, Mode,
create_announce_mode_recursive_command, create_announce_mode_recursive_command,
) )
from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd
from tmtccmd.tc.decorator import ServiceProviderParams from tmtccmd.tc.decorator import ServiceProviderParams
@ -21,11 +24,16 @@ class SystemMode:
IDLE = AcsMode.IDLE IDLE = AcsMode.IDLE
class ActionId(enum.IntEnum):
EXECUTE_I2C_REBOOT = 10
class OpCode: class OpCode:
BOOT_MODE = "boot" BOOT_MODE = "boot"
SAFE_MODE = "safe" SAFE_MODE = "safe"
IDLE_MODE = "idle" IDLE_MODE = "idle"
ANNOUNCE_MODES = "announce_modes" ANNOUNCE_MODES = "announce_modes"
REBOOT_I2C = "reboot_i2c"
class Info: class Info:
@ -33,6 +41,7 @@ class Info:
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"
REBOOT_I2C = "Reboot I2C bus"
@service_provider(CustomServiceList.SYSTEM.value) @service_provider(CustomServiceList.SYSTEM.value)
@ -52,6 +61,9 @@ def build_system_cmds(p: ServiceProviderParams):
elif o == OpCode.BOOT_MODE: elif o == OpCode.BOOT_MODE:
q.add_log_cmd(f"{prefix}: {Info.BOOT_MODE}") q.add_log_cmd(f"{prefix}: {Info.BOOT_MODE}")
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.BOOT, 0)) q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.BOOT, 0))
elif o == OpCode.REBOOT_I2C:
q.add_log_cmd(f"{prefix}: {Info.REBOOT_I2C}")
q.add_pus_tc(create_action_cmd(EIVE_SYSTEM_ID, ActionId.EXECUTE_I2C_REBOOT))
@tmtc_definitions_provider @tmtc_definitions_provider
@ -61,6 +73,7 @@ def add_system_cmd_defs(defs: TmtcDefinitionWrapper):
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)
oce.add(keys=OpCode.REBOOT_I2C, info=Info.REBOOT_I2C)
defs.add_service( defs.add_service(
name=CustomServiceList.SYSTEM.value, name=CustomServiceList.SYSTEM.value,
info="EIVE system commands", info="EIVE system commands",