This commit is contained in:
Robin Müller 2022-05-24 15:06:34 +02:00
commit 4b902ce01b
3 changed files with 105 additions and 93 deletions

View File

@ -12,6 +12,7 @@ list yields a list of all related PRs for each release.
# [v1.12.0]
- Add full regular reboot command
- Add Rad Sensor HK parsing
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/81
- Add procedures, parser functions and general application functionalities

View File

@ -1,6 +1,7 @@
from pus_tc.devs.gps import GpsOpCodes
from pus_tc.devs.pcdu import add_pcdu_cmds
from pus_tc.devs.rad_sensor import add_rad_sens_cmds
from pus_tc.system.core import add_core_controller_definitions
from tmtccmd.config import (
add_op_code_entry,
add_service_op_code_entry,
@ -13,11 +14,10 @@ from pus_tc.devs.heater import add_heater_cmds
from pus_tc.devs.rtd import specify_rtd_cmds
from pus_tc.devs.reaction_wheels import add_rw_cmds
from pus_tc.devs.bpx_batt import BpxOpCodes
from tmtccmd.config.globals import get_default_service_op_code_dict
def get_eive_service_op_code_dict() -> ServiceOpCodeDictT:
from tmtccmd.config.globals import get_default_service_op_code_dict
service_op_code_dict = get_default_service_op_code_dict()
add_bpx_cmd_definitions(cmd_dict=service_op_code_dict)
add_core_controller_definitions(cmd_dict=service_op_code_dict)
@ -322,67 +322,8 @@ def add_bpx_cmd_definitions(cmd_dict: ServiceOpCodeDictT):
)
def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT):
from pus_tc.system.core import OpCodes
od = dict()
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT, info="Reboot with Prompt")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_SELF, info="Reboot Self")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_0_0, info="Reboot 0 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_0_1, info="Reboot 0 1")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_1_0, info="Reboot 1 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_1_1, info="Reboot 1 1")
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.ENABLE_REBOOT_FILE_HANDLING,
info="Enable reboot file handling",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.DISABLE_REBOOT_FILE_HANDLING,
info="Disable reboot file handling",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_ALL_REBOOT_COUNTERS,
info="Reset all reboot counters",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_00,
info="Reset reboot counter 0 0",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_01,
info="Reset reboot counter 0 1",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_10,
info="Reset reboot counter 1 0",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_11,
info="Reset reboot counter 1 1",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.GET_HK,
info="Request housekeeping set",
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.CORE.value,
info="Reboot Self",
op_code_entry=od,
)
def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
from pus_tc.devs.plpcdu import OpCodes, Info
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON

View File

@ -1,6 +1,8 @@
import enum
from tmtccmd.config.definitions import QueueCommands
from config.definitions import CustomServiceList
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.logging import get_console_logger
@ -19,7 +21,8 @@ class ActionIds(enum.IntEnum):
RESET_REBOOT_COUNTER_10 = 9
RESET_REBOOT_COUNTER_11 = 10
SET_MAX_REBOOT_CNT = 11
REBOOT = 32
XSC_REBOOT = 32
FULL_REBOOT = 34
class SetIds(enum.IntEnum):
@ -27,21 +30,27 @@ class SetIds(enum.IntEnum):
class OpCodes:
REBOOT = ["0", "reboot"]
REBOOT_SELF = ["1", "reboot_self"]
REBOOT_0_0 = ["2", "reboot_0_0"]
REBOOT_0_1 = ["3", "reboot_0_1"]
REBOOT_1_0 = ["4", "reboot_1_0"]
REBOOT_1_1 = ["5", "reboot_1_1"]
ENABLE_REBOOT_FILE_HANDLING = ["6", "rbh-off"]
DISABLE_REBOOT_FILE_HANDLING = ["7", "rbh-on"]
RESET_ALL_REBOOT_COUNTERS = ["8", "rbh-reset-a"]
RESET_REBOOT_COUNTER_00 = ["9", "rbh-reset-00"]
RESET_REBOOT_COUNTER_01 = ["10", "rbh-reset-01"]
RESET_REBOOT_COUNTER_10 = ["11", "rbh-reset-10"]
RESET_REBOOT_COUNTER_11 = ["12", "rbh-reset-11"]
SET_MAX_REBOOT_CNT = ["13", "rbh-max-cnt"]
GET_HK = ["14", "get-hk"]
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"]
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"]
class Info:
REBOOT_XSC = "XSC reboot with prompt"
REBOOT_FULL = "Full regular reboot"
class Chip(enum.IntEnum):
@ -56,8 +65,65 @@ class Copy(enum.IntEnum):
NONE = 2
def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT):
od = dict()
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC)
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_FULL, info=Info.REBOOT_FULL)
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_SELF, info="Reboot Self")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_0_0, info="Reboot 0 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_0_1, info="Reboot 0 1")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_1_0, info="Reboot 1 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_1_1, info="Reboot 1 1")
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.GET_HK,
info="Request housekeeping set",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.ENABLE_REBOOT_FILE_HANDLING,
info="Enable reboot file handling",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.DISABLE_REBOOT_FILE_HANDLING,
info="Disable reboot file handling",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_ALL_REBOOT_COUNTERS,
info="Reset all reboot counters",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_00,
info="Reset reboot counter 0 0",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_01,
info="Reset reboot counter 0 1",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_10,
info="Reset reboot counter 1 0",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_11,
info="Reset reboot counter 1 1",
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.CORE.value,
info="Core Controller",
op_code_entry=od,
)
def pack_core_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.REBOOT:
if op_code in OpCodes.REBOOT_XSC:
reboot_self, chip_select, copy_select = determine_reboot_params()
perform_reboot_cmd(
tc_queue=tc_queue,
@ -65,31 +131,35 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
chip=chip_select,
copy=copy_select,
)
elif op_code in OpCodes.REBOOT_SELF:
if op_code in OpCodes.REBOOT_FULL:
tc_queue.appendleft((QueueCommands.PRINT, f"Core Command: {Info.REBOOT_FULL}"))
cmd = generate_action_command(object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT)
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.XSC_REBOOT_SELF:
perform_reboot_cmd(tc_queue=tc_queue, reboot_self=True)
elif op_code in OpCodes.REBOOT_0_0:
if op_code in OpCodes.XSC_REBOOT_0_0:
perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM
)
elif op_code in OpCodes.REBOOT_0_1:
if op_code in OpCodes.XSC_REBOOT_0_1:
perform_reboot_cmd(
tc_queue=tc_queue,
reboot_self=False,
chip=Chip.CHIP_0,
copy=Copy.COPY_1_GOLD,
)
elif op_code in OpCodes.REBOOT_1_0:
if op_code in OpCodes.XSC_REBOOT_1_0:
perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_0_NOM
)
elif op_code in OpCodes.REBOOT_1_1:
if op_code in OpCodes.XSC_REBOOT_1_1:
perform_reboot_cmd(
tc_queue=tc_queue,
reboot_self=False,
chip=Chip.CHIP_1,
copy=Copy.COPY_1_GOLD,
)
elif op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING:
if op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING:
tc_queue.appendleft((QueueCommands.PRINT, "Disabling reboot file handling"))
app_data = bytearray([0])
generate_action_command(
@ -97,7 +167,7 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING,
app_data=app_data,
)
elif op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING:
if op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING:
tc_queue.appendleft((QueueCommands.PRINT, "Enabling reboot file handling"))
app_data = bytearray([1])
generate_action_command(
@ -105,32 +175,32 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING,
app_data=app_data,
)
elif op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS:
if op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting all reboot counters"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_ALL_REBOOT_COUNTERS
)
elif op_code in OpCodes.RESET_REBOOT_COUNTER_00:
if op_code in OpCodes.RESET_REBOOT_COUNTER_00:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 0 0"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_00
)
elif op_code in OpCodes.RESET_REBOOT_COUNTER_01:
if op_code in OpCodes.RESET_REBOOT_COUNTER_01:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 0 1"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_01
)
elif op_code in OpCodes.RESET_REBOOT_COUNTER_10:
if op_code in OpCodes.RESET_REBOOT_COUNTER_10:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 1 0"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_10
)
elif op_code in OpCodes.RESET_REBOOT_COUNTER_11:
if op_code in OpCodes.RESET_REBOOT_COUNTER_11:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 1 1"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_11
)
elif op_code in OpCodes.GET_HK:
if op_code in OpCodes.GET_HK:
tc_queue.appendleft((QueueCommands.PRINT, "Requesting housekeeping set"))
sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetIds.HK)
command = generate_one_hk_command(sid, 201)
@ -192,7 +262,7 @@ def perform_reboot_cmd(
)
action_cmd = generate_action_command(
object_id=CORE_CONTROLLER_ID,
action_id=ActionIds.REBOOT,
action_id=ActionIds.XSC_REBOOT,
app_data=tc_data,
ssc=0,
)