Skip to content

Commit 3cc4702

Browse files
committed
feat(openthread): enable parent search function for MTD
1 parent dc678de commit 3cc4702

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

components/openthread/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,27 @@ menu "OpenThread"
327327
commands in the OpenThread command line. These commands allow users to manipulate low-level
328328
features of the storage and 15.4 radio.
329329

330+
config OPENTHREAD_PARENT_SEARCH_MTD
331+
bool "Enable Parent Search"
332+
depends on OPENTHREAD_MTD
333+
default y
334+
help
335+
Select this option to enable "Periodic Parent Search" function for MTD. This checks the average
336+
RSS to its current parent every periodically and starts a parent search process if the average
337+
RSS is below OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD. This feature is always enabled for FTDs.
338+
menu "Parent Search Configurations"
339+
depends on OPENTHREAD_PARENT_SEARCH_MTD
340+
config OPENTHREAD_PARENT_SEARCH_CHECK_INTERVAL_MINS
341+
int "The interval in minutes for a child to check the trigger condition to perform a parent search"
342+
default 9
343+
config OPENTHREAD_PARENT_SEARCH_BACKOFF_INTERVAL_MINS
344+
int "The backoff interval in minutes for a child to not perform a parent search after triggering one"
345+
default 600
346+
config OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD
347+
int "The RSS threshold used to trigger a parent search"
348+
default -65
349+
endmenu
350+
330351
menu "Thread Memory Allocation"
331352
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
332353
config OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM

components/openthread/private_include/openthread-core-esp32x-mtd-config.h

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -449,3 +449,47 @@
449449
#ifndef OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD
450450
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320)
451451
#endif
452+
453+
/**
454+
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
455+
*
456+
* Enable the periodic parent search feature.
457+
*
458+
*/
459+
#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
460+
#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE CONFIG_OPENTHREAD_PARENT_SEARCH_MTD
461+
#endif
462+
463+
/**
464+
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL
465+
*
466+
* Specifies the interval in seconds for a child to check the trigger condition to perform a parent search.
467+
*
468+
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
469+
*/
470+
#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL
471+
#define OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL CONFIG_OPENTHREAD_PARENT_SEARCH_CHECK_INTERVAL_MINS * 60
472+
#endif
473+
474+
/**
475+
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL
476+
*
477+
* Specifies the backoff interval in seconds for a child to not perform a parent search after triggering one. This is
478+
* used when device is an MTD child.
479+
*
480+
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
481+
*/
482+
#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL
483+
#define OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL CONFIG_OPENTHREAD_PARENT_SEARCH_BACKOFF_INTERVAL_MINS * 60
484+
#endif
485+
486+
/**
487+
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD
488+
*
489+
* Specifies the RSS threshold used to trigger a parent search.
490+
*
491+
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
492+
*/
493+
#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD
494+
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD CONFIG_OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD
495+
#endif

examples/openthread/ot_sleepy_device/light_sleep/sdkconfig.defaults

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ CONFIG_MBEDTLS_ECJPAKE_C=y
2020
#
2121
CONFIG_OPENTHREAD_ENABLED=y
2222
CONFIG_OPENTHREAD_BORDER_ROUTER=n
23+
CONFIG_OPENTHREAD_MTD=y
2324
CONFIG_OPENTHREAD_DNS64_CLIENT=y
2425
CONFIG_OPENTHREAD_CLI=y
2526
# end of OpenThread

0 commit comments

Comments
 (0)