This commit is contained in:
2023-11-22 10:17:05 +01:00
parent 07b13c153d
commit b3920524ab
33 changed files with 731 additions and 616 deletions

View File

@ -6,7 +6,7 @@ from spacepackets.ecss import PusTelecommand
from eive_tmtc.config.definitions import CustomServiceList
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.pus.s200_fsfw_mode import Mode, pack_mode_data, Subservice
from tmtccmd.tmtc import service_provider
from tmtccmd.tmtc import DefaultPusQueueHelper, service_provider
from tmtccmd.tmtc.decorator import ServiceProviderParams
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
@ -79,11 +79,8 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
)
@service_provider(CustomServiceList.SCEX.value)
def pack_scex_cmds(p: ServiceProviderParams): # noqa C901
op_code = p.op_code
q = p.queue_helper
if op_code == OpCode.ON:
def pack_scex_cmds(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
if cmd_str == OpCode.ON:
q.add_log_cmd(Info.SWITCH_ON)
q.add_pus_tc(
PusTelecommand(
@ -92,7 +89,7 @@ def pack_scex_cmds(p: ServiceProviderParams): # noqa C901
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.ON, 0),
)
)
if op_code == OpCode.NORMAL:
if cmd_str == OpCode.NORMAL:
q.add_log_cmd(Info.NORMAL)
q.add_pus_tc(
PusTelecommand(
@ -101,7 +98,7 @@ def pack_scex_cmds(p: ServiceProviderParams): # noqa C901
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.NORMAL, 0),
)
)
if op_code == OpCode.OFF:
if cmd_str == OpCode.OFF:
q.add_log_cmd(Info.SWITCH_OFF)
q.add_pus_tc(
PusTelecommand(
@ -110,20 +107,20 @@ def pack_scex_cmds(p: ServiceProviderParams): # noqa C901
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.OFF, 0),
)
)
if op_code == OpCode.PING:
if cmd_str == OpCode.PING:
q.add_log_cmd(Info.PING)
app_data = bytes([0])
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.PING, app_data))
if op_code == OpCode.ION_CMD:
if cmd_str == OpCode.ION_CMD:
q.add_log_cmd(Info.ION_CMD)
app_data = bytes([0])
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.ION_CMD, app_data))
if op_code == OpCode.TEMP_CMD:
if cmd_str == OpCode.TEMP_CMD:
q.add_log_cmd(Info.TEMP_CMD)
app_data = bytes([0])
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.TEMP_CMD, app_data))
if op_code == OpCode.EXP_STATUS_CMD:
if cmd_str == OpCode.EXP_STATUS_CMD:
q.add_log_cmd(Info.EXP_STATUS_CMD)
app_data = bytes([0])
q.add_pus_tc(
@ -131,7 +128,7 @@ def pack_scex_cmds(p: ServiceProviderParams): # noqa C901
)
# one cell
if op_code == OpCode.ONE_CELLS_CMD:
if cmd_str == OpCode.ONE_CELLS_CMD:
q.add_log_cmd(Info.ONE_CELLS_CMD)
app_data = bytearray([0])
@ -178,7 +175,7 @@ def pack_scex_cmds(p: ServiceProviderParams): # noqa C901
create_action_cmd(SCEX_HANDLER_ID, ActionId.ONE_CELLS_CMD, app_data)
)
if op_code == OpCode.ALL_CELLS_CMD:
if cmd_str == OpCode.ALL_CELLS_CMD:
q.add_log_cmd(Info.ALL_CELLS_CMD)
app_data = bytearray([0])
@ -210,7 +207,7 @@ def pack_scex_cmds(p: ServiceProviderParams): # noqa C901
create_action_cmd(SCEX_HANDLER_ID, ActionId.ALL_CELLS_CMD, app_data)
)
if op_code == OpCode.FRAM:
if cmd_str == OpCode.FRAM:
q.add_log_cmd(Info.FRAM)
app_data = bytes([0])
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.FRAM, app_data))