diff --git a/eive_tmtc/tmtc/acs/star_tracker.py b/eive_tmtc/tmtc/acs/star_tracker.py index 28e9936..1923613 100644 --- a/eive_tmtc/tmtc/acs/star_tracker.py +++ b/eive_tmtc/tmtc/acs/star_tracker.py @@ -95,7 +95,10 @@ class StarTrackerActionId(enum.IntEnum): LOGLEVEL = 81 LOG_SUBSCRIPTION = 82 DEBUG_CAMERA = 83 + # Legacy variable. FIRMWARE_UPDATE = 84 + FIRMWARE_UPDATE_MAIN = 84 + FIRMWARE_UPDATE_BACKUP = 101 SET_TIME_FROM_SYS_TIME = 87 ADD_SECONDARY_TM_TO_NORMAL_MODE = 95 RESET_SECONDARY_TM_SET = 96 @@ -119,9 +122,10 @@ class OpCode: UPLOAD_IMAGE = "upload_image" DOWNLOAD_IMAGE = "download_image" SET_IMG_PROCESSOR_MODE = "set_img_proc_mode" - FW_UPDATE = "fw_update" + FW_UPDATE_MAIN = "fw_update_main" SET_TIME_FROM_SYS_TIME = "set_time" RELOAD_JSON_CFG_FILE = "reload_json_cfg" + FW_UPDATE_BACKUP = "fw_update_backup" class Info: @@ -135,7 +139,8 @@ class Info: DOWNLOAD_IMAGE = "Download Optical Image" TAKE_IMAGE = "Take Image" SET_IMG_PROCESSOR_MODE = "Set Image Processor Mode" - FW_UPDATE = "Firmware Update" + FW_UPDATE_MAIN = "Update Main Firmware Slot" + 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." @@ -642,12 +647,21 @@ def pack_star_tracker_commands( # noqa C901 + bytearray(json_file, "utf-8") ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) - if cmd_str == OpCode.FW_UPDATE: - q.add_log_cmd(Info.FW_UPDATE) + if cmd_str == OpCode.FW_UPDATE_MAIN: + q.add_log_cmd(Info.FW_UPDATE_MAIN) firmware = get_firmware() data = ( obyt - + struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE) + + struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE_MAIN) + + firmware.encode() + ) + q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) + if cmd_str == OpCode.FW_UPDATE_BACKUP: + q.add_log_cmd(Info.FW_UPDATE_BACKUP) + firmware = get_firmware() + data = ( + obyt + + struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE_BACKUP) + firmware.encode() ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) @@ -1185,7 +1199,7 @@ def create_str_node() -> CmdTreeNode: node.add_child( CmdTreeNode(OpCode.RESET_SECONDARY_TM_SET, Info.RESET_SECONDARY_TM_SET) ) - node.add_child(CmdTreeNode(OpCode.FW_UPDATE, Info.FW_UPDATE)) + node.add_child(CmdTreeNode(OpCode.FW_UPDATE_MAIN, Info.FW_UPDATE_MAIN)) node.add_child( CmdTreeNode(OpCode.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME) ) @@ -1212,7 +1226,7 @@ def add_str_cmds(defs: TmtcDefinitionWrapper): ) 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, Info.FW_UPDATE) + 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)