diff --git a/components/openthread/Kconfig b/components/openthread/Kconfig index 428f180c47..aaeae58543 100644 --- a/components/openthread/Kconfig +++ b/components/openthread/Kconfig @@ -327,6 +327,27 @@ menu "OpenThread" commands in the OpenThread command line. These commands allow users to manipulate low-level 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" depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC) config OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM diff --git a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h index d4e3b0c3af..045faff323 100644 --- a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h @@ -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 */ @@ -449,3 +449,47 @@ #ifndef OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD #define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320) #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 diff --git a/examples/openthread/ot_sleepy_device/light_sleep/sdkconfig.defaults b/examples/openthread/ot_sleepy_device/light_sleep/sdkconfig.defaults index 94a0b3e11a..1b7c25c723 100644 --- a/examples/openthread/ot_sleepy_device/light_sleep/sdkconfig.defaults +++ b/examples/openthread/ot_sleepy_device/light_sleep/sdkconfig.defaults @@ -20,6 +20,7 @@ CONFIG_MBEDTLS_ECJPAKE_C=y # CONFIG_OPENTHREAD_ENABLED=y CONFIG_OPENTHREAD_BORDER_ROUTER=n +CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_DNS64_CLIENT=y CONFIG_OPENTHREAD_CLI=y # end of OpenThread