feat(openthread): enable parent search function for MTD

This commit is contained in:
Tan Yan Quan
2025-04-22 16:51:17 +08:00
parent e2561f0410
commit 81124ed7d8
3 changed files with 67 additions and 1 deletions

View File

@ -327,6 +327,27 @@ menu "OpenThread"
commands in the OpenThread command line. These commands allow users to manipulate low-level commands in the OpenThread command line. These commands allow users to manipulate low-level
features of the storage and 15.4 radio. features of the storage and 15.4 radio.
config OPENTHREAD_PARENT_SEARCH_MTD
bool "Enable Parent Search"
depends on OPENTHREAD_MTD
default y
help
Select this option to enable "Periodic Parent Search" function for MTD. This checks the average
RSS to its current parent every periodically and starts a parent search process if the average
RSS is below OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD. This feature is always enabled for FTDs.
menu "Parent Search Configurations"
depends on OPENTHREAD_PARENT_SEARCH_MTD
config OPENTHREAD_PARENT_SEARCH_CHECK_INTERVAL_MINS
int "The interval in minutes for a child to check the trigger condition to perform a parent search"
default 9
config OPENTHREAD_PARENT_SEARCH_BACKOFF_INTERVAL_MINS
int "The backoff interval in minutes for a child to not perform a parent search after triggering one"
default 600
config OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD
int "The RSS threshold used to trigger a parent search"
default -65
endmenu
menu "Thread Memory Allocation" menu "Thread Memory Allocation"
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC) depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
config OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM config OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -449,3 +449,47 @@
#ifndef OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD #ifndef OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320) #define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320)
#endif #endif
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
*
* Enable the periodic parent search feature.
*
*/
#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE CONFIG_OPENTHREAD_PARENT_SEARCH_MTD
#endif
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL
*
* Specifies the interval in seconds for a child to check the trigger condition to perform a parent search.
*
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
*/
#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL
#define OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL CONFIG_OPENTHREAD_PARENT_SEARCH_CHECK_INTERVAL_MINS * 60
#endif
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL
*
* Specifies the backoff interval in seconds for a child to not perform a parent search after triggering one. This is
* used when device is an MTD child.
*
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
*/
#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL
#define OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL CONFIG_OPENTHREAD_PARENT_SEARCH_BACKOFF_INTERVAL_MINS * 60
#endif
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD
*
* Specifies the RSS threshold used to trigger a parent search.
*
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
*/
#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD CONFIG_OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD
#endif

View File

@ -20,6 +20,7 @@ CONFIG_MBEDTLS_ECJPAKE_C=y
# #
CONFIG_OPENTHREAD_ENABLED=y CONFIG_OPENTHREAD_ENABLED=y
CONFIG_OPENTHREAD_BORDER_ROUTER=n CONFIG_OPENTHREAD_BORDER_ROUTER=n
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_DNS64_CLIENT=y CONFIG_OPENTHREAD_DNS64_CLIENT=y
CONFIG_OPENTHREAD_CLI=y CONFIG_OPENTHREAD_CLI=y
# end of OpenThread # end of OpenThread