added command to select STR slot
All checks were successful
EIVE/-/pipeline/head This commit looks good
All checks were successful
EIVE/-/pipeline/head This commit looks good
This commit is contained in:
parent
d811735b8d
commit
d35bc01397
@ -10,12 +10,10 @@ import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config import CmdTreeNode, TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
create_request_one_diag_command,
|
||||
create_request_one_hk_command,
|
||||
@ -23,6 +21,7 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
disable_periodic_hk_command,
|
||||
make_sid,
|
||||
)
|
||||
from tmtccmd.pus.s20_fsfw_param import create_load_param_cmd, create_scalar_u8_parameter
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
@ -40,6 +39,7 @@ class FirmwareTarget(enum.IntEnum):
|
||||
|
||||
class ParamId(enum.IntEnum):
|
||||
FIRMWARE_TARGET = 1
|
||||
FIRMWARE_TARGET_PERSISTENT = 2
|
||||
|
||||
|
||||
class StarTrackerActionId(enum.IntEnum):
|
||||
@ -135,8 +135,10 @@ class OpCode:
|
||||
SET_TIME_FROM_SYS_TIME = "set_time"
|
||||
RELOAD_JSON_CFG_FILE = "reload_json_cfg"
|
||||
FW_UPDATE_BACKUP = "fw_update_backup"
|
||||
SELECT_TARGET_FIRMWARE_MAIN = "select_fw_target_main"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP = "select_fw_target_backup"
|
||||
SELECT_TARGET_FIRMWARE_MAIN = "fw_main"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP = "fw_backup"
|
||||
SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT = "fw_main_persistent"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT = "fw_backup_persistent"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -154,8 +156,12 @@ class Info:
|
||||
FW_UPDATE_BACKUP = "Update Backup Firmware Slot"
|
||||
SET_TIME_FROM_SYS_TIME = "Set time from system time"
|
||||
RELOAD_JSON_CFG_FILE = "Reload JSON configuration file. Reboot still required."
|
||||
SELECT_TARGET_FIRMWARE_MAIN = "Select main slot firmware"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP = "Select backup slot firmware"
|
||||
SELECT_TARGET_FIRMWARE_MAIN = "Select main firmware slot"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP = "Select backup firmware slot"
|
||||
SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT = "Select main firmware slot persistently"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT = (
|
||||
"Select backup firmware slot persistently"
|
||||
)
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
@ -710,6 +716,35 @@ def pack_star_tracker_commands( # noqa C901
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(STAR_TRACKER_ID, StarTrackerActionId.RELOAD_JSON_CFG_FILE)
|
||||
)
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_MAIN:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_MAIN)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(False, FirmwareTarget.MAIN))
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_BACKUP:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_BACKUP)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(False, FirmwareTarget.BACKUP))
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_BACKUP)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(True, FirmwareTarget.MAIN))
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_BACKUP)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(True, FirmwareTarget.BACKUP))
|
||||
|
||||
|
||||
def create_update_firmware_target_cmd(
|
||||
persistent: bool, fw_target: FirmwareTarget
|
||||
) -> PusTelecommand:
|
||||
if persistent:
|
||||
param_id = ParamId.FIRMWARE_TARGET_PERSISTENT
|
||||
else:
|
||||
param_id = ParamId.FIRMWARE_TARGET
|
||||
return create_load_param_cmd(
|
||||
create_scalar_u8_parameter(
|
||||
STAR_TRACKER_ID,
|
||||
0,
|
||||
param_id,
|
||||
fw_target,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def request_dataset(q: DefaultPusQueueHelper, req_type: DataSetRequest):
|
||||
@ -1213,33 +1248,8 @@ def create_str_node() -> CmdTreeNode:
|
||||
CmdTreeNode(OpCode.RESET_SECONDARY_TM_SET, Info.RESET_SECONDARY_TM_SET)
|
||||
)
|
||||
node.add_child(CmdTreeNode(OpCode.FW_UPDATE_MAIN, Info.FW_UPDATE_MAIN))
|
||||
node.add_child(CmdTreeNode(OpCode.FW_UPDATE_BACKUP, Info.FW_UPDATE_BACKUP))
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME)
|
||||
)
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_str_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.ON_BOOTLOADER, "Mode On, Submode Bootloader")
|
||||
oce.add(OpCode.ON_FIRMWARE, "Mode On, Submode Firmware")
|
||||
oce.add(OpCode.NORMAL, "Mode Normal")
|
||||
oce.add(OpCode.OFF, "Mode Off")
|
||||
oce.add(OpCode.PING, "Star Tracker: Ping")
|
||||
oce.add(OpCode.TAKE_IMAGE, "Take Image")
|
||||
oce.add(OpCode.UPLOAD_IMAGE, Info.UPLOAD_IMAGE)
|
||||
oce.add(OpCode.DOWNLOAD_IMAGE, Info.DOWNLOAD_IMAGE)
|
||||
oce.add(OpCode.ONE_SHOOT_HK, Info.ONE_SHOOT_HK)
|
||||
oce.add(OpCode.ENABLE_HK, Info.ENABLE_HK)
|
||||
oce.add(OpCode.DISABLE_HK, Info.DISABLE_HK)
|
||||
oce.add(OpCode.SET_IMG_PROCESSOR_MODE, Info.SET_IMG_PROCESSOR_MODE)
|
||||
oce.add(
|
||||
OpCode.ADD_SECONDARY_TM_TO_NORMAL_MODE, Info.ADD_SECONDARY_TM_TO_NORMAL_MODE
|
||||
)
|
||||
oce.add(OpCode.READ_SECONDARY_TM_SET, Info.READ_SECONDARY_TM_SET)
|
||||
oce.add(OpCode.RESET_SECONDARY_TM_SET, Info.RESET_SECONDARY_TM_SET)
|
||||
oce.add(OpCode.FW_UPDATE_MAIN, Info.FW_UPDATE_MAIN)
|
||||
oce.add(OpCode.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME)
|
||||
oce.add(OpCode.RELOAD_JSON_CFG_FILE, Info.RELOAD_JSON_CFG_FILE)
|
||||
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
|
||||
|
Loading…
Reference in New Issue
Block a user