diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 9a8e0a5..630d667 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -24,6 +24,7 @@ from tmtccmd.tmtc import service_provider from tmtccmd.tmtc.decorator import ServiceProviderParams from eive_tmtc.utility.input_helper import InputHelper 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 _LOGGER = logging.getLogger(__name__) @@ -93,6 +94,10 @@ class ActionId(enum.IntEnum): TC_FLASH_READ_FULL_FILE = 30 +class ParamId(enum.IntEnum): + PLOC_SUPV_CMD_TO_ON = 1 + + class OpCode: ON = "on" OFF = "off" @@ -115,6 +120,8 @@ class OpCode: SIMPLEX_SEND_FILE = "simplex_send_file" DOWNLINK_DATA_MODULATE = "downlink_data_modulate" 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: @@ -137,6 +144,10 @@ class Info: FLASH_GET_DIR_CONTENT = "Get flash directory content on MPSoC" DOWNLINK_DATA_MODULATE = "Downlink data modulate" 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): @@ -171,6 +182,13 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCode.SIMPLEX_SEND_FILE, Info.SIMPLEX_SEND_FILE) oce.add(OpCode.DOWNLINK_DATA_MODULATE, Info.DOWNLINK_DATA_MODULATE) 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) @@ -179,6 +197,7 @@ def pack_ploc_mpsoc_commands( # noqa C901 p: ServiceProviderParams, ): # noqa C901: Complexity okay here. object_id = get_object_ids().get(PLOC_MPSOC_ID) + assert object_id is not None q = p.queue_helper prefix = "PLOC MPSoC" op_code = p.op_code @@ -313,6 +332,24 @@ def pack_ploc_mpsoc_commands( # noqa C901 q.add_log_cmd("PLOC MPSoC: 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)) + 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(