feat(openthread): optimized the autostart macro

This commit is contained in:
Xu Si Yu
2026-04-16 17:21:44 +08:00
parent e875d571b2
commit ca34d4ddda
5 changed files with 7 additions and 21 deletions

View File

@@ -125,16 +125,13 @@ void app_main(void)
#if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
esp_cli_custom_command_init();
#endif
#if CONFIG_OPENTHREAD_BORDER_ROUTER_AUTO_START
#if CONFIG_OPENTHREAD_STATE_INDICATOR_ENABLE
ESP_ERROR_CHECK(esp_openthread_state_indicator_init(esp_openthread_get_instance()));
#endif
#if CONFIG_OPENTHREAD_BORDER_ROUTER && CONFIG_OPENTHREAD_NETWORK_AUTO_START
ESP_ERROR_CHECK(esp_openthread_border_router_start());
#if CONFIG_ESP_COEX_SW_COEXIST_ENABLE && CONFIG_SOC_IEEE802154_SUPPORTED
ESP_ERROR_CHECK(esp_coex_wifi_i154_enable());
#endif
#endif
#if CONFIG_OPENTHREAD_STATE_INDICATOR_ENABLE
ESP_ERROR_CHECK(esp_openthread_state_indicator_init(esp_openthread_get_instance()));
#endif
#if CONFIG_OPENTHREAD_NETWORK_AUTO_START
ot_network_auto_start();
#endif
}

View File

@@ -0,0 +1,2 @@
CONFIG_OPENTHREAD_NETWORK_AUTO_START=y
CONFIG_OPENTHREAD_CLI_WIFI=n

View File

@@ -1,6 +1,5 @@
# Enable BR auto start for Ethernet builds
CONFIG_OPENTHREAD_NETWORK_AUTO_START=y
CONFIG_OPENTHREAD_BORDER_ROUTER_AUTO_START=y
# Enable PPP support as a workaround to ensure LWIP thread-lib compatibility for Ethernet builds
CONFIG_LWIP_PPP_SUPPORT=y

View File

@@ -1,6 +1,6 @@
set(srcs "")
if(CONFIG_OPENTHREAD_BORDER_ROUTER_AUTO_START)
if(CONFIG_OPENTHREAD_BORDER_ROUTER AND CONFIG_OPENTHREAD_NETWORK_AUTO_START)
list(APPEND srcs "ot_examples_br.c")
endif()

View File

@@ -1,12 +0,0 @@
menu "OpenThread Border Router Config"
depends on OPENTHREAD_BORDER_ROUTER
config OPENTHREAD_BORDER_ROUTER_AUTO_START
depends on OPENTHREAD_BORDER_ROUTER
bool 'Enable the border router auto start'
default n
help
If enabled, the program will automatically connect to the backbone network and
initialize the border router at startup.
endmenu