From 90518676b1da228dcf50401de8a3974b26522fc1 Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Mon, 24 Jul 2023 19:50:58 +0800 Subject: [PATCH] fix(openthread): Use the existing dataset for autostart --- examples/openthread/ot_br/main/esp_ot_br.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/openthread/ot_br/main/esp_ot_br.c b/examples/openthread/ot_br/main/esp_ot_br.c index 249ea27654..7ad9f7a6bd 100644 --- a/examples/openthread/ot_br/main/esp_ot_br.c +++ b/examples/openthread/ot_br/main/esp_ot_br.c @@ -71,7 +71,9 @@ static void ot_task_worker(void *aContext) #if CONFIG_OPENTHREAD_BR_AUTO_START ESP_ERROR_CHECK(esp_openthread_border_router_init()); - ESP_ERROR_CHECK(esp_openthread_auto_start(NULL)); + otOperationalDatasetTlvs dataset; + otError error = otDatasetGetActiveTlvs(esp_openthread_get_instance(), &dataset); + ESP_ERROR_CHECK(esp_openthread_auto_start((error == OT_ERROR_NONE) ? &dataset : NULL)); #endif // CONFIG_OPENTHREAD_BR_AUTO_START esp_cli_custom_command_init();