diff --git a/eive_tmtc/tmtc/system.py b/eive_tmtc/tmtc/system.py index 37d2d6a..63edb28 100644 --- a/eive_tmtc/tmtc/system.py +++ b/eive_tmtc/tmtc/system.py @@ -1,3 +1,5 @@ +import enum + from eive_tmtc.config.definitions import CustomServiceList from eive_tmtc.tmtc.acs.subsystem import AcsMode from tmtccmd.config.tmtc import ( @@ -12,6 +14,7 @@ from tmtccmd.tc.pus_200_fsfw_mode import ( Mode, create_announce_mode_recursive_command, ) +from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd from tmtccmd.tc.decorator import ServiceProviderParams @@ -21,11 +24,16 @@ class SystemMode: IDLE = AcsMode.IDLE +class ActionId(enum.IntEnum): + EXECUTE_I2C_REBOOT = 10 + + class OpCode: BOOT_MODE = "boot" SAFE_MODE = "safe" IDLE_MODE = "idle" ANNOUNCE_MODES = "announce_modes" + REBOOT_I2C = "reboot_i2c" class Info: @@ -33,6 +41,7 @@ class Info: SAFE_MODE = "Command System into Safe Mode" IDLE_MODE = "Command System into Idle Pointing Mode" ANNOUNCE_MODES = "Announce mode recursively" + REBOOT_I2C = "Reboot I2C bus" @service_provider(CustomServiceList.SYSTEM.value) @@ -52,6 +61,9 @@ def build_system_cmds(p: ServiceProviderParams): 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, 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 @@ -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.IDLE_MODE, info=Info.IDLE_MODE) oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES) + oce.add(keys=OpCode.REBOOT_I2C, info=Info.REBOOT_I2C) defs.add_service( name=CustomServiceList.SYSTEM.value, info="EIVE system commands",