This commit is contained in:
@ -2,16 +2,12 @@ import enum
|
||||
import json
|
||||
|
||||
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 DefaultPusQueueHelper, service_provider
|
||||
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
||||
from tmtccmd.config.tmtc import CmdTreeNode
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||
from eive_tmtc.config.object_ids import SCEX_HANDLER_ID
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, Subservice, pack_mode_data
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import SCEX_HANDLER_ID
|
||||
|
||||
USE_SCEX_CONF_FILE = True
|
||||
|
||||
@ -26,10 +22,8 @@ class OpCode:
|
||||
ALL_CELLS_CMD = "allcells"
|
||||
FRAM = "fram"
|
||||
|
||||
ON = "on"
|
||||
SWITCH_ON = "on"
|
||||
OFF = "off"
|
||||
SWITCH_OFF = OFF
|
||||
SWITCH_OFF = "off"
|
||||
NORMAL = "normal"
|
||||
|
||||
|
||||
@ -59,28 +53,20 @@ class Info:
|
||||
NORMAL = "Switch SCEX to normal mode"
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.PING, info=Info.PING)
|
||||
oce.add(keys=OpCode.ION_CMD, info=Info.ION_CMD)
|
||||
oce.add(keys=OpCode.TEMP_CMD, info=Info.TEMP_CMD)
|
||||
oce.add(keys=OpCode.EXP_STATUS_CMD, info=Info.EXP_STATUS_CMD)
|
||||
oce.add(keys=OpCode.ONE_CELLS_CMD, info=Info.ONE_CELLS_CMD)
|
||||
|
||||
oce.add(keys=OpCode.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD)
|
||||
oce.add(keys=OpCode.FRAM, info=Info.FRAM)
|
||||
oce.add(keys=OpCode.ON, info=Info.SWITCH_ON)
|
||||
oce.add(keys=OpCode.OFF, info=Info.SWITCH_OFF)
|
||||
oce.add(keys=OpCode.NORMAL, info=Info.NORMAL)
|
||||
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SCEX.value, info="SCEX Device", op_code_entry=oce
|
||||
)
|
||||
def create_scex_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
scex_node = CmdTreeNode("ploc_mpsoc", "PLOC MPSoC")
|
||||
for op_code, info in combined_dict.items():
|
||||
scex_node.add_child(CmdTreeNode(op_code, info))
|
||||
return scex_node
|
||||
|
||||
|
||||
def pack_scex_cmds(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
if cmd_str == OpCode.ON:
|
||||
if cmd_str == OpCode.SWITCH_ON:
|
||||
q.add_log_cmd(Info.SWITCH_ON)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -98,7 +84,7 @@ def pack_scex_cmds(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.NORMAL, 0),
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.OFF:
|
||||
if cmd_str == OpCode.SWITCH_OFF:
|
||||
q.add_log_cmd(Info.SWITCH_OFF)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -158,7 +144,8 @@ def pack_scex_cmds(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
dac_weight1 = json_data["dac_weight1"]
|
||||
dac_weight2 = json_data["dac_weight2"]
|
||||
dac_weight3 = json_data["dac_weight3"]
|
||||
|
||||
else:
|
||||
raise ValueError("CLI support for SCEX params not implemented")
|
||||
# in app_data
|
||||
# app_data.extend(struct.pack("!H", first_dac))
|
||||
app_data.append(cell_select)
|
||||
@ -192,6 +179,8 @@ def pack_scex_cmds(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
dac_weight2 = json_data["dac_weight2"]
|
||||
dac_weight3 = json_data["dac_weight3"]
|
||||
|
||||
else:
|
||||
raise ValueError("CLI support for SCEX params not implemented")
|
||||
# in app_data
|
||||
# app_data.extend(struct.pack("!H", first_dac))
|
||||
append_16_bit_val(packet=app_data, val=first_dac[cn])
|
||||
|
Reference in New Issue
Block a user