prep v2.18.1

- Add announce boot counts command
This commit is contained in:
Robin Müller 2023-03-11 15:23:02 +01:00
parent 432a642422
commit a40c881b9f
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 55 additions and 40 deletions

View File

@ -16,6 +16,10 @@ list yields a list of all related PRs for each release.
- Missing heater location fix.
## Added
- Request to announce reboot counts in core controller commands
# [v2.18.0] 2023-03-11
## Added

View File

@ -1,4 +1,4 @@
__version__ = "2.18.0"
__version__ = "2.18.1"
import logging
from pathlib import Path
@ -6,7 +6,7 @@ from pathlib import Path
SW_NAME = "eive-tmtc"
VERSION_MAJOR = 2
VERSION_MINOR = 18
VERSION_REVISION = 0
VERSION_REVISION = 1
EIVE_TMTC_ROOT = Path(__file__).parent
PACKAGE_ROOT = EIVE_TMTC_ROOT.parent

View File

@ -22,6 +22,7 @@ class ActionId(enum.IntEnum):
LIST_DIR_INTO_FILE = 0
ANNOUNCE_VERSION = 1
ANNOUNCE_CURRENT_IMAGE = 2
ANNOUNCE_BOOT_COUNTS = 3
SWITCH_REBOOT_FILE_HANDLING = 5
RESET_REBOOT_COUNTER = 6
SWITCH_IMG_LOCK = 7
@ -43,33 +44,35 @@ class SetId(enum.IntEnum):
class OpCode:
ANNOUNCE_VERSION = "announce_version"
ANNOUNCE_CURRENT_IMAGE = "announce_current_image"
REBOOT_XSC = ["0", "reboot_xsc"]
XSC_REBOOT_SELF = ["1", "reboot_self"]
XSC_REBOOT_0_0 = ["2", "reboot_00"]
XSC_REBOOT_0_1 = ["3", "reboot_01"]
XSC_REBOOT_1_0 = ["4", "reboot_10"]
XSC_REBOOT_1_1 = ["5", "reboot_11"]
REBOOT_FULL = ["6", "reboot_regular"]
GET_HK = ["7", "get_hk"]
ANNOUNCE_BOOT_COUNTS = "announce_boot_counts"
REBOOT_XSC = ["reboot_xsc"]
XSC_REBOOT_SELF = ["reboot_self"]
XSC_REBOOT_0_0 = ["reboot_00"]
XSC_REBOOT_0_1 = ["reboot_01"]
XSC_REBOOT_1_0 = ["reboot_10"]
XSC_REBOOT_1_1 = ["reboot_11"]
REBOOT_FULL = ["reboot_regular"]
GET_HK = ["get_hk"]
OBSW_UPDATE_FROM_SD_0 = ["obsw_update_sd0"]
OBSW_UPDATE_FROM_SD_1 = ["obsw_update_sd1"]
OBSW_UPDATE_FROM_TMP = ["obsw_update_tmp"]
SWITCH_TO_SD_0 = ["switch_to_sd_0"]
SWITCH_TO_SD_1 = ["switch_to_sd_1"]
SWITCH_TO_BOTH_SD_CARDS = ["switch_to_both_sd_cards"]
ENABLE_REBOOT_FILE_HANDLING = ["32", "rbh_off"]
DISABLE_REBOOT_FILE_HANDLING = ["33", "rbh_on"]
RESET_ALL_REBOOT_COUNTERS = ["34", "rbh_reset_a"]
RESET_REBOOT_COUNTER_00 = ["35", "rbh_reset_00"]
RESET_REBOOT_COUNTER_01 = ["36", "rbh_reset_01"]
RESET_REBOOT_COUNTER_10 = ["37", "rbh_reset_10"]
RESET_REBOOT_COUNTER_11 = ["38", "rbh_reset_11"]
SET_MAX_REBOOT_CNT = ["39", "rbh_max_cnt"]
ENABLE_REBOOT_FILE_HANDLING = ["rbh_off"]
DISABLE_REBOOT_FILE_HANDLING = ["rbh_on"]
RESET_ALL_REBOOT_COUNTERS = ["rbh_reset_a"]
RESET_REBOOT_COUNTER_00 = ["rbh_reset_00"]
RESET_REBOOT_COUNTER_01 = ["rbh_reset_01"]
RESET_REBOOT_COUNTER_10 = ["rbh_reset_10"]
RESET_REBOOT_COUNTER_11 = ["rbh_reset_11"]
SET_MAX_REBOOT_CNT = ["rbh_max_cnt"]
class Info:
ANNOUNCE_VERSION = "Announce version"
ANNOUNCE_CURRENT_IMAGE = "Announce current image"
ANNOUNCE_BOOT_COUNTS = "Announce boot counts"
REBOOT_XSC = "XSC reboot with prompt"
REBOOT_FULL = "Full regular reboot"
OBSW_UPDATE_FROM_SD_0 = "Update OBSW from SD Card 0"
@ -97,6 +100,7 @@ def add_core_controller_definitions(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=OpCode.ANNOUNCE_VERSION, info=Info.ANNOUNCE_VERSION)
oce.add(keys=OpCode.ANNOUNCE_CURRENT_IMAGE, info=Info.ANNOUNCE_CURRENT_IMAGE)
oce.add(keys=OpCode.ANNOUNCE_BOOT_COUNTS, info=Info.ANNOUNCE_BOOT_COUNTS)
oce.add(keys=OpCode.REBOOT_XSC, info=Info.REBOOT_XSC)
oce.add(keys=OpCode.REBOOT_XSC, info=Info.REBOOT_XSC)
oce.add(keys=OpCode.REBOOT_FULL, info=Info.REBOOT_FULL)
@ -153,12 +157,17 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code == OpCode.ANNOUNCE_VERSION:
q.add_log_cmd(f"{Info.ANNOUNCE_VERSION}")
q.add_pus_tc(create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_VERSION))
if op_code == OpCode.ANNOUNCE_CURRENT_IMAGE:
elif op_code == OpCode.ANNOUNCE_CURRENT_IMAGE:
q.add_log_cmd(f"{Info.ANNOUNCE_CURRENT_IMAGE}")
q.add_pus_tc(
create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_CURRENT_IMAGE)
)
if op_code in OpCode.REBOOT_XSC:
elif op_code == OpCode.ANNOUNCE_BOOT_COUNTS:
q.add_log_cmd(f"{Info.ANNOUNCE_BOOT_COUNTS}")
q.add_pus_tc(
create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_BOOT_COUNTS)
)
elif op_code in OpCode.REBOOT_XSC:
reboot_self, chip_select, copy_select = determine_reboot_params()
add_xsc_reboot_cmd(
q=q,
@ -166,38 +175,38 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
chip=chip_select,
copy=copy_select,
)
if op_code in OpCode.REBOOT_FULL:
elif op_code in OpCode.REBOOT_FULL:
q.add_log_cmd(f"Core Command: {Info.REBOOT_FULL}")
q.add_pus_tc(
create_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionId.FULL_REBOOT
)
)
if op_code in OpCode.XSC_REBOOT_SELF:
elif op_code in OpCode.XSC_REBOOT_SELF:
add_xsc_reboot_cmd(q=q, reboot_self=True)
if op_code in OpCode.XSC_REBOOT_0_0:
elif op_code in OpCode.XSC_REBOOT_0_0:
add_xsc_reboot_cmd(
q=q, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM
)
if op_code in OpCode.XSC_REBOOT_0_1:
elif op_code in OpCode.XSC_REBOOT_0_1:
add_xsc_reboot_cmd(
q=q,
reboot_self=False,
chip=Chip.CHIP_0,
copy=Copy.COPY_1_GOLD,
)
if op_code in OpCode.XSC_REBOOT_1_0:
elif op_code in OpCode.XSC_REBOOT_1_0:
add_xsc_reboot_cmd(
q=q, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_0_NOM
)
if op_code in OpCode.XSC_REBOOT_1_1:
elif op_code in OpCode.XSC_REBOOT_1_1:
add_xsc_reboot_cmd(
q=q,
reboot_self=False,
chip=Chip.CHIP_1,
copy=Copy.COPY_1_GOLD,
)
if op_code in OpCode.DISABLE_REBOOT_FILE_HANDLING:
elif op_code in OpCode.DISABLE_REBOOT_FILE_HANDLING:
q.add_log_cmd("Disabling reboot file handling")
user_data = bytearray([0])
q.add_pus_tc(
@ -207,7 +216,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
user_data=user_data,
)
)
if op_code in OpCode.ENABLE_REBOOT_FILE_HANDLING:
elif op_code in OpCode.ENABLE_REBOOT_FILE_HANDLING:
q.add_log_cmd("Enabling reboot file handling")
user_data = bytearray([1])
q.add_pus_tc(
@ -217,7 +226,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
user_data=user_data,
)
)
if op_code in OpCode.RESET_ALL_REBOOT_COUNTERS:
elif op_code in OpCode.RESET_ALL_REBOOT_COUNTERS:
q.add_log_cmd("Resetting all reboot counters")
q.add_pus_tc(
create_action_cmd(
@ -225,38 +234,38 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
action_id=ActionId.RESET_REBOOT_COUNTER,
)
)
if op_code in OpCode.RESET_REBOOT_COUNTER_00:
elif op_code in OpCode.RESET_REBOOT_COUNTER_00:
reset_specific_boot_counter(q, 0, 0)
if op_code in OpCode.RESET_REBOOT_COUNTER_01:
elif op_code in OpCode.RESET_REBOOT_COUNTER_01:
reset_specific_boot_counter(q, 0, 1)
if op_code in OpCode.RESET_REBOOT_COUNTER_10:
elif op_code in OpCode.RESET_REBOOT_COUNTER_10:
reset_specific_boot_counter(q, 1, 0)
if op_code in OpCode.RESET_REBOOT_COUNTER_11:
elif op_code in OpCode.RESET_REBOOT_COUNTER_11:
reset_specific_boot_counter(q, 1, 1)
if op_code in OpCode.OBSW_UPDATE_FROM_SD_0:
elif op_code in OpCode.OBSW_UPDATE_FROM_SD_0:
q.add_log_cmd(Info.OBSW_UPDATE_FROM_SD_0)
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_SD_0))
if op_code in OpCode.OBSW_UPDATE_FROM_SD_1:
elif op_code in OpCode.OBSW_UPDATE_FROM_SD_1:
q.add_log_cmd(Info.OBSW_UPDATE_FROM_SD_1)
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_SD_1))
if 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_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_TMP))
if 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_pus_tc(
create_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionId.SWITCH_TO_SD_0
)
)
if op_code in OpCode.SWITCH_TO_SD_1:
elif op_code in OpCode.SWITCH_TO_SD_1:
q.add_log_cmd(Info.SWITCH_TO_SD_1)
q.add_pus_tc(
create_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionId.SWITCH_TO_SD_1
)
)
if op_code in OpCode.SWITCH_TO_BOTH_SD_CARDS:
elif op_code in OpCode.SWITCH_TO_BOTH_SD_CARDS:
while True:
active_sd_card = int(input("Please specify active SD cqrd [0/1]: "))
if active_sd_card not in [0, 1]:
@ -270,10 +279,12 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
user_data=bytes([active_sd_card]),
)
)
if op_code in OpCode.GET_HK:
elif op_code in OpCode.GET_HK:
q.add_log_cmd("Requesting housekeeping set")
sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetId.HK)
q.add_pus_tc(generate_one_hk_command(sid))
else:
_LOGGER.warning(f"Unknown operation code {op_code} for core controller commands")
def reset_specific_boot_counter(q: DefaultPusQueueHelper, chip: int, copy: int):