Merge branch 'main' into bump_tmtccmd_dependency
All checks were successful
EIVE/-/pipeline/pr-main This commit looks good
All checks were successful
EIVE/-/pipeline/pr-main This commit looks good
This commit is contained in:
commit
aad725a4e5
@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
|
||||
## Added
|
||||
|
||||
- Core controller auto switch enable and disable command.
|
||||
|
||||
# [v5.10.1] 2023-10-27
|
||||
|
||||
- Minor improvements, update event translation.
|
||||
|
@ -3,6 +3,7 @@ import logging
|
||||
import os
|
||||
import struct
|
||||
from pathlib import Path
|
||||
from typing import Tuple
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
@ -52,6 +53,8 @@ class ActionId(enum.IntEnum):
|
||||
SWITCH_TO_SD_0 = 16
|
||||
SWITCH_TO_SD_1 = 17
|
||||
SWITCH_TO_BOTH_SD_CARDS = 18
|
||||
AUTO_SWITCH_ENABLE = 19
|
||||
AUTO_SWITCH_DISABLE = 20
|
||||
XSC_REBOOT = 32
|
||||
FULL_REBOOT = 34
|
||||
EXECUTE_SHELL_CMD_BLOCKING = 40
|
||||
@ -110,6 +113,8 @@ class OpCode:
|
||||
RWD_RESET_REBOOT_COUNTER_10 = "rwd_reset_10"
|
||||
RWD_RESET_REBOOT_COUNTER_11 = "rwd_reset_11"
|
||||
RWD_SET_MAX_REBOOT_CNT = "rwd_max_cnt"
|
||||
AUTO_SWITCH_ENABLE = "auto_switch_enable"
|
||||
AUTO_SWITCH_DISABLE = "auto_switch_disable"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -135,6 +140,8 @@ class Info:
|
||||
MV_HELPER = "Filesystem Move Helper"
|
||||
RM_HELPER = "Filesystem Removal Helper"
|
||||
MKDIR_HELPER = "Filesystem Directory Creation Helper"
|
||||
AUTO_SWITCH_ENABLE = "Enable Auto-Switch Feature with a specific target image"
|
||||
AUTO_SWITCH_DISABLE = "Disable Auto-Switch Feature"
|
||||
|
||||
|
||||
class Chip(enum.IntEnum):
|
||||
@ -176,6 +183,8 @@ def add_core_controller_definitions(defs: TmtcDefinitionWrapper):
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_TMP, info=Info.OBSW_UPDATE_FROM_TMP)
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_0, info=Info.OBSW_UPDATE_FROM_SD_0)
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_1, info=Info.OBSW_UPDATE_FROM_SD_1)
|
||||
oce.add(keys=OpCode.AUTO_SWITCH_ENABLE, info=Info.AUTO_SWITCH_ENABLE)
|
||||
oce.add(keys=OpCode.AUTO_SWITCH_DISABLE, info=Info.AUTO_SWITCH_DISABLE)
|
||||
oce.add(keys=OpCode.SYSTEMCTL_CMD_EXECUTOR, info=Info.SYSTEMCTL_CMD_EXECUTOR)
|
||||
oce.add(
|
||||
keys=OpCode.EXECUTE_SHELL_CMD_BLOCKING, info=Info.EXECUTE_SHELL_CMD_BLOCKING
|
||||
@ -381,6 +390,20 @@ def pack_core_commands( # noqa C901
|
||||
elif op_code in OpCode.OBSW_UPDATE_FROM_TMP:
|
||||
q.add_log_cmd(Info.OBSW_UPDATE_FROM_TMP)
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_TMP))
|
||||
elif op_code in OpCode.AUTO_SWITCH_ENABLE:
|
||||
q.add_log_cmd(Info.AUTO_SWITCH_ENABLE)
|
||||
chip, copy = determine_chip_and_copy()
|
||||
user_data = bytes([chip, copy])
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
CORE_CONTROLLER_ID, ActionId.AUTO_SWITCH_ENABLE, user_data
|
||||
)
|
||||
)
|
||||
elif op_code in OpCode.AUTO_SWITCH_DISABLE:
|
||||
q.add_log_cmd(Info.AUTO_SWITCH_DISABLE)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.AUTO_SWITCH_DISABLE)
|
||||
)
|
||||
elif op_code in OpCode.SWITCH_TO_SD_0:
|
||||
q.add_log_cmd(Info.SWITCH_TO_SD_0)
|
||||
q.add_pus_tc(
|
||||
@ -551,18 +574,17 @@ def create_full_reboot_cmds() -> PusTelecommand:
|
||||
)
|
||||
|
||||
|
||||
def determine_reboot_params() -> (bool, Chip, Copy):
|
||||
chip_select = -1
|
||||
copy_select = -1
|
||||
def determine_reboot_params() -> Tuple[bool, Chip, Copy]:
|
||||
reboot_self = input("Reboot self? [y/n]: ")
|
||||
if reboot_self in ["y", "yes", "1"]:
|
||||
_LOGGER.info("Rebooting currently running image")
|
||||
return True, chip_select, copy_select
|
||||
return True, Chip.NONE, Copy.NONE
|
||||
_LOGGER.info("Rebooting image specified by chip and copy")
|
||||
return False, determine_chip_and_copy()
|
||||
chip, copy = determine_chip_and_copy()
|
||||
return False, chip, copy
|
||||
|
||||
|
||||
def determine_chip_and_copy() -> (int, int):
|
||||
def determine_chip_and_copy() -> Tuple[Chip, Copy]:
|
||||
while True:
|
||||
chip_select = input("Chip select [0/1]: ")
|
||||
if chip_select in ["0", "1"]:
|
||||
|
Loading…
Reference in New Issue
Block a user