feat(openthread): add mesh local prefix configuration

This commit is contained in:
zhangwenxu
2023-07-31 17:56:49 +08:00
parent f7fd03a79a
commit 4988c1a3d1
4 changed files with 41 additions and 5 deletions

View File

@@ -0,0 +1,9 @@
menu "OpenThread CLI Example"
config OPENTHREAD_AUTO_START
bool 'Enable the automatic start mode.'
default False
help
If enabled, the Openthread Device will create or connect to thread network with pre-configured
network parameters automatically. Otherwise, user need to configure Thread via CLI command manually.
endmenu

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: CC0-1.0
*
@@ -86,6 +86,11 @@ static void ot_task_worker(void *aContext)
// Run the main loop
#if CONFIG_OPENTHREAD_CLI
esp_openthread_cli_create_task();
#endif
#if CONFIG_OPENTHREAD_AUTO_START
otOperationalDatasetTlvs dataset;
otError error = otDatasetGetActiveTlvs(esp_openthread_get_instance(), &dataset);
ESP_ERROR_CHECK(esp_openthread_auto_start((error == OT_ERROR_NONE) ? &dataset : NULL));
#endif
esp_openthread_launch_mainloop();