Add new PDEC commands

This commit is contained in:
2023-04-14 19:21:51 +02:00
parent 183cd85907
commit 63c584e061
2 changed files with 56 additions and 20 deletions

View File

@ -5,11 +5,13 @@
@author J. Meier
@date 22.11.2021
"""
import enum
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd
from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd
from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter
from tmtccmd.config.tmtc import (
@ -28,16 +30,23 @@ class CommandId:
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
class ParameterId:
class ParameterId(enum.IntEnum):
POSITIVE_WINDOW = 0
NEGATIVE_WINDOW = 1
class ActionId(enum.IntEnum):
RESET_NO_INIT = 2
RESET_WITH_INIT = 3
class OpCode:
PRINT_CLCW = "print_clcw"
PRINT_MON_REG = "print_mon_reg"
POSITIVE_WINDOW = "positive_window"
NEGATIVE_WINDOW = "negative_window"
RESET_WITH_INIT = "reset_with_init"
RESET_NO_INIT = "reset_no_init"
class Info:
@ -47,6 +56,8 @@ class Info:
)
POSITIVE_WINDOW = "Change positive window parameter for AD frames"
NEGATIVE_WINDOW = "Change negative window parameter for AD frames"
RESET_WITH_INIT = "Reset with full initialization"
RESET_NO_INIT = "Reset with mandatory initialization"
def pack_pdec_handler_test(
@ -88,6 +99,16 @@ def pack_pdec_handler_test(
).pack()
)
)
if op_code == OpCode.RESET_NO_INIT:
q.add_log_cmd(f"{prefix}: {Info.RESET_NO_INIT}")
q.add_pus_tc(
create_action_cmd(object_id=object_id, action_id=ActionId.RESET_NO_INIT)
)
if op_code == OpCode.RESET_WITH_INIT:
q.add_log_cmd(f"{prefix}: {Info.RESET_WITH_INIT}")
q.add_pus_tc(
create_action_cmd(object_id=object_id, action_id=ActionId.RESET_WITH_INIT)
)
@tmtc_definitions_provider
@ -97,4 +118,6 @@ def add_pdec_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.PRINT_MON_REG, Info.PRINT_MON_REG)
oce.add(OpCode.POSITIVE_WINDOW, Info.POSITIVE_WINDOW)
oce.add(OpCode.NEGATIVE_WINDOW, Info.NEGATIVE_WINDOW)
oce.add(OpCode.RESET_WITH_INIT, Info.RESET_WITH_INIT)
oce.add(OpCode.RESET_NO_INIT, Info.RESET_NO_INIT)
defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce)