on cmd for SCEX
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
import enum
|
||||
import json
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from config.definitions import CustomServiceList
|
||||
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||
@ -24,6 +26,8 @@ class OpCodes:
|
||||
ALL_CELLS_CMD = ["5", "allcells"]
|
||||
FRAM = ["6", "fram"]
|
||||
|
||||
SWITCH_ON = ["7", "on"]
|
||||
|
||||
|
||||
class ActionIds(enum.IntEnum):
|
||||
PING = 7
|
||||
@ -46,6 +50,8 @@ class Info:
|
||||
ALL_CELLS_CMD = "All Cells"
|
||||
FRAM = "Read FRAM"
|
||||
|
||||
SWITCH_ON = "Switch Scex on"
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
@ -58,6 +64,7 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
|
||||
oce.add(keys=OpCodes.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD)
|
||||
oce.add(keys=OpCodes.FRAM, info=Info.FRAM)
|
||||
oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON)
|
||||
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SCEX.value, info="SCEX Device", op_code_entry=oce
|
||||
@ -68,6 +75,15 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
def pack_scex_cmds(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code in OpCodes.SWITCH_ON:
|
||||
q.add_log_cmd(Info.SWITCH_ON)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Modes.ON, 0),
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.PING:
|
||||
q.add_log_cmd(Info.PING)
|
||||
app_data = bytes([0])
|
||||
|
Reference in New Issue
Block a user