Add new param command #268

Merged
meggert merged 2 commits from ploc-mpsoc-skip-supv-commanding-param into main 2024-01-29 10:15:13 +01:00
2 changed files with 41 additions and 0 deletions

View File

@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
# [unreleased] # [unreleased]
## Added
- Added new parameter commands for PLOC MPSoC to skip SUPV commanding.
# [v5.12.1] 2023-12-13 # [v5.12.1] 2023-12-13
## Added ## Added

View File

@ -24,6 +24,7 @@ from tmtccmd.tmtc import service_provider
from tmtccmd.tmtc.decorator import ServiceProviderParams from tmtccmd.tmtc.decorator import ServiceProviderParams
from eive_tmtc.utility.input_helper import InputHelper from eive_tmtc.utility.input_helper import InputHelper
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
from tmtccmd.pus.s20_fsfw_param import create_load_param_cmd, create_scalar_u8_parameter
from tmtccmd.pus.s8_fsfw_action import create_action_cmd from tmtccmd.pus.s8_fsfw_action import create_action_cmd
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -93,6 +94,10 @@ class ActionId(enum.IntEnum):
TC_FLASH_READ_FULL_FILE = 30 TC_FLASH_READ_FULL_FILE = 30
class ParamId(enum.IntEnum):
PLOC_SUPV_CMD_TO_ON = 1
class OpCode: class OpCode:
ON = "on" ON = "on"
OFF = "off" OFF = "off"
@ -115,6 +120,8 @@ class OpCode:
SIMPLEX_SEND_FILE = "simplex_send_file" SIMPLEX_SEND_FILE = "simplex_send_file"
DOWNLINK_DATA_MODULATE = "downlink_data_modulate" DOWNLINK_DATA_MODULATE = "downlink_data_modulate"
MODE_SNAPSHOT = "mode_snapshot" MODE_SNAPSHOT = "mode_snapshot"
ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "enable_ploc_supv_cmd_to_on"
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = "disable_ploc_supv_cmd_to_on"
class Info: class Info:
@ -137,6 +144,10 @@ class Info:
FLASH_GET_DIR_CONTENT = "Get flash directory content on MPSoC" FLASH_GET_DIR_CONTENT = "Get flash directory content on MPSoC"
DOWNLINK_DATA_MODULATE = "Downlink data modulate" DOWNLINK_DATA_MODULATE = "Downlink data modulate"
MODE_SNAPSHOT = "Mode Snapshot" MODE_SNAPSHOT = "Mode Snapshot"
ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "Enable PLOC SUPV commanding when switching ON"
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = (
"Disable PLOC SUPV commanding when switching ON"
)
class MemAddresses(enum.IntEnum): class MemAddresses(enum.IntEnum):
@ -171,6 +182,13 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.SIMPLEX_SEND_FILE, Info.SIMPLEX_SEND_FILE) oce.add(OpCode.SIMPLEX_SEND_FILE, Info.SIMPLEX_SEND_FILE)
oce.add(OpCode.DOWNLINK_DATA_MODULATE, Info.DOWNLINK_DATA_MODULATE) oce.add(OpCode.DOWNLINK_DATA_MODULATE, Info.DOWNLINK_DATA_MODULATE)
oce.add(OpCode.MODE_SNAPSHOT, Info.MODE_SNAPSHOT) oce.add(OpCode.MODE_SNAPSHOT, Info.MODE_SNAPSHOT)
oce.add(
OpCode.ENABLE_PLOC_SUPV_COMMANDING_TO_ON, Info.ENABLE_PLOC_SUPV_COMMANDING_TO_ON
)
oce.add(
OpCode.DISABLE_PLOC_SUPV_COMMANDING_TO_ON,
Info.DISABLE_PLOC_SUPV_COMMANDING_TO_ON,
)
defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce) defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
@ -179,6 +197,7 @@ def pack_ploc_mpsoc_commands( # noqa C901
p: ServiceProviderParams, p: ServiceProviderParams,
): # noqa C901: Complexity okay here. ): # noqa C901: Complexity okay here.
object_id = get_object_ids().get(PLOC_MPSOC_ID) object_id = get_object_ids().get(PLOC_MPSOC_ID)
assert object_id is not None
q = p.queue_helper q = p.queue_helper
prefix = "PLOC MPSoC" prefix = "PLOC MPSoC"
op_code = p.op_code op_code = p.op_code
@ -313,6 +332,24 @@ def pack_ploc_mpsoc_commands( # noqa C901
q.add_log_cmd("PLOC MPSoC: Mode snapshot") q.add_log_cmd("PLOC MPSoC: Mode snapshot")
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_SNAPSHOT) data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_SNAPSHOT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCode.ENABLE_PLOC_SUPV_COMMANDING_TO_ON:
q.add_log_cmd(Info.ENABLE_PLOC_SUPV_COMMANDING_TO_ON)
q.add_pus_tc(
create_load_param_cmd(
create_scalar_u8_parameter(
object_id.as_bytes, 0, ParamId.PLOC_SUPV_CMD_TO_ON, 0
)
)
)
if op_code == OpCode.DISABLE_PLOC_SUPV_COMMANDING_TO_ON:
q.add_log_cmd(Info.DISABLE_PLOC_SUPV_COMMANDING_TO_ON)
q.add_pus_tc(
create_load_param_cmd(
create_scalar_u8_parameter(
object_id.as_bytes, 0, ParamId.PLOC_SUPV_CMD_TO_ON, 1
)
)
)
def generate_write_mem_command( def generate_write_mem_command(