From 592c25f0e3a8bab3ba71b7fc38854e8899cfd1ff Mon Sep 17 00:00:00 2001 From: WangQixiang Date: Wed, 25 Sep 2024 09:12:08 +0800 Subject: [PATCH] thread_br: avoid duplicate initialization for border router Closes RMN-2001 RMN-2047 --- .../src/thread_br/esp_rmaker_thread_br_launcher.c | 8 +++++++- examples/thread_br/sdkconfig.defaults | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/esp_rainmaker/src/thread_br/esp_rmaker_thread_br_launcher.c b/components/esp_rainmaker/src/thread_br/esp_rmaker_thread_br_launcher.c index d33d5565..14a5e315 100644 --- a/components/esp_rainmaker/src/thread_br/esp_rmaker_thread_br_launcher.c +++ b/components/esp_rainmaker/src/thread_br/esp_rmaker_thread_br_launcher.c @@ -139,7 +139,13 @@ static void thread_br_event_handler(void* arg, esp_event_base_t event_base, int3 } } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_CONNECTED) { esp_openthread_lock_acquire(portMAX_DELAY); - ESP_ERROR_CHECK(esp_openthread_border_router_init()); + // Create link local address for Wi-Fi Station interface + esp_netif_create_ip6_linklocal(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF")); + static bool border_router_initialized = false; + if (!border_router_initialized) { + ESP_ERROR_CHECK(esp_openthread_border_router_init()); + border_router_initialized = true; + } esp_openthread_lock_release(); } } diff --git a/examples/thread_br/sdkconfig.defaults b/examples/thread_br/sdkconfig.defaults index 437d89a9..bbb392a3 100644 --- a/examples/thread_br/sdkconfig.defaults +++ b/examples/thread_br/sdkconfig.defaults @@ -31,6 +31,10 @@ CONFIG_ESP_RMAKER_LOCAL_CTRL_STACK_SIZE=8096 # Application Rollback CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y +# Increase the MQTT task stack size to use generate new Thread dataset command +CONFIG_MQTT_USE_CUSTOM_CONFIG=y +CONFIG_MQTT_TASK_STACK_SIZE=7168 + # mbedTLS CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_SSL_PROTO_DTLS=y