Merge branch 'main' into introduce_tm_db
All checks were successful
EIVE/-/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-11-13 11:13:38 +01:00
commit 02dc6174bf
2 changed files with 32 additions and 6 deletions

View File

@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
# [unreleased] # [unreleased]
## Added
- Core controller auto switch enable and disable command.
# [v5.10.1] 2023-10-27 # [v5.10.1] 2023-10-27
- Minor improvements, update event translation. - Minor improvements, update event translation.

View File

@ -3,6 +3,7 @@ import logging
import os import os
import struct import struct
from pathlib import Path from pathlib import Path
from typing import Tuple
from eive_tmtc.pus_tm.defs import PrintWrapper from eive_tmtc.pus_tm.defs import PrintWrapper
@ -52,6 +53,8 @@ class ActionId(enum.IntEnum):
SWITCH_TO_SD_0 = 16 SWITCH_TO_SD_0 = 16
SWITCH_TO_SD_1 = 17 SWITCH_TO_SD_1 = 17
SWITCH_TO_BOTH_SD_CARDS = 18 SWITCH_TO_BOTH_SD_CARDS = 18
AUTO_SWITCH_ENABLE = 19
AUTO_SWITCH_DISABLE = 20
XSC_REBOOT = 32 XSC_REBOOT = 32
FULL_REBOOT = 34 FULL_REBOOT = 34
EXECUTE_SHELL_CMD_BLOCKING = 40 EXECUTE_SHELL_CMD_BLOCKING = 40
@ -110,6 +113,8 @@ class OpCode:
RWD_RESET_REBOOT_COUNTER_10 = "rwd_reset_10" RWD_RESET_REBOOT_COUNTER_10 = "rwd_reset_10"
RWD_RESET_REBOOT_COUNTER_11 = "rwd_reset_11" RWD_RESET_REBOOT_COUNTER_11 = "rwd_reset_11"
RWD_SET_MAX_REBOOT_CNT = "rwd_max_cnt" RWD_SET_MAX_REBOOT_CNT = "rwd_max_cnt"
AUTO_SWITCH_ENABLE = "auto_switch_enable"
AUTO_SWITCH_DISABLE = "auto_switch_disable"
class Info: class Info:
@ -135,6 +140,8 @@ class Info:
MV_HELPER = "Filesystem Move Helper" MV_HELPER = "Filesystem Move Helper"
RM_HELPER = "Filesystem Removal Helper" RM_HELPER = "Filesystem Removal Helper"
MKDIR_HELPER = "Filesystem Directory Creation 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): 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_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_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.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.SYSTEMCTL_CMD_EXECUTOR, info=Info.SYSTEMCTL_CMD_EXECUTOR)
oce.add( oce.add(
keys=OpCode.EXECUTE_SHELL_CMD_BLOCKING, info=Info.EXECUTE_SHELL_CMD_BLOCKING 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: elif op_code in OpCode.OBSW_UPDATE_FROM_TMP:
q.add_log_cmd(Info.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)) 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: elif op_code in OpCode.SWITCH_TO_SD_0:
q.add_log_cmd(Info.SWITCH_TO_SD_0) q.add_log_cmd(Info.SWITCH_TO_SD_0)
q.add_pus_tc( q.add_pus_tc(
@ -551,18 +574,17 @@ def create_full_reboot_cmds() -> PusTelecommand:
) )
def determine_reboot_params() -> (bool, Chip, Copy): def determine_reboot_params() -> Tuple[bool, Chip, Copy]:
chip_select = -1
copy_select = -1
reboot_self = input("Reboot self? [y/n]: ") reboot_self = input("Reboot self? [y/n]: ")
if reboot_self in ["y", "yes", "1"]: if reboot_self in ["y", "yes", "1"]:
_LOGGER.info("Rebooting currently running image") _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") _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: while True:
chip_select = input("Chip select [0/1]: ") chip_select = input("Chip select [0/1]: ")
if chip_select in ["0", "1"]: if chip_select in ["0", "1"]: