Skip to content

Commit 28630c3

Browse files
committed
fix(ext_cli): init the wifi config in esp_cli_custom_command_init
1 parent da2303c commit 28630c3

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ variables:
66
CI_DOCKER_REGISTRY: "ciregistry.espressif.cn:8443"
77
ESP_THREAD_BR_PATH: "$CI_PROJECT_DIR"
88
CI_TOOLS_PATH: "$CI_PROJECT_DIR/tools/ci"
9-
ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env-v6.0:1"
9+
ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env-v6.0:2"
1010
ESP_IDF_HTTP: "https://gitlab-ci-token:${CI_JOB_TOKEN}@${ESP_GITLAB}/espressif/esp-idf.git"
1111

1212
pre_commit:

components/esp_ot_cli_extension/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.3.5"
1+
version: "1.4.0"
22
description: Espressif OpenThread CLI Extension
33
url: https://github.com/espressif/esp-thread-br/tree/main/components/esp_ot_cli_extension
44
dependencies:

components/esp_ot_cli_extension/src/esp_ot_cli_extension.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ static const otCliCommand kCommands[] = {
5757

5858
void esp_cli_custom_command_init()
5959
{
60+
#if CONFIG_OPENTHREAD_CLI_WIFI
61+
ESP_ERROR_CHECK(esp_ot_wifi_config_init());
62+
#endif
6063
esp_ot_heap_diag_init();
6164
otInstance *instance = esp_openthread_get_instance();
6265
otCliSetUserCommands(kCommands, (sizeof(kCommands) / sizeof(kCommands[0])), instance);

components/esp_ot_cli_extension/src/esp_ot_wifi_cmd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,12 @@ otError esp_ot_process_wifi_cmd(void *aContext, uint8_t aArgsLength, char *aArgs
364364

365365
esp_err_t esp_ot_wifi_config_init(void)
366366
{
367-
esp_err_t err = nvs_open("wifi_config", NVS_READWRITE, &s_wifi_config_nvs_handle);
368-
ESP_RETURN_ON_ERROR(err, OT_EXT_CLI_TAG, "Failed to open wifi_config NVS namespace (0x%x)", err);
367+
static bool s_wifi_config_init = false;
368+
if (!s_wifi_config_init) {
369+
esp_err_t err = nvs_open("wifi_config", NVS_READWRITE, &s_wifi_config_nvs_handle);
370+
ESP_RETURN_ON_ERROR(err, OT_EXT_CLI_TAG, "Failed to open wifi_config NVS namespace (0x%x)", err);
371+
s_wifi_config_init = true;
372+
}
369373
return ESP_OK;
370374
}
371375

examples/basic_thread_border_router/main/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
dependencies:
33
espressif/mdns: "^1.0.0"
44
espressif/esp_ot_cli_extension:
5-
version: "~1.3.0"
5+
version: "~1.4.0"
66
espressif/esp_rcp_update:
77
version: "~1.4.0"
88
esp_br_http_ota:

examples/common/thread_border_router/src/border_router_launch.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ static void rcp_failure_handler(void)
104104

105105
static void ot_br_init(void *ctx)
106106
{
107-
#if CONFIG_OPENTHREAD_CLI_WIFI
108-
ESP_ERROR_CHECK(esp_ot_wifi_config_init());
109-
#endif
110107
#if CONFIG_OPENTHREAD_BR_AUTO_START
111108
#if CONFIG_EXAMPLE_CONNECT_WIFI || CONFIG_EXAMPLE_CONNECT_ETHERNET
112109
bool wifi_or_ethernet_connected = false;

examples/m5stack_thread_border_router/main/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
dependencies:
33
espressif/mdns: "^1.0.0"
44
espressif/esp_ot_cli_extension:
5-
version: "~1.3.0"
5+
version: "~1.4.0"
66
espressif/esp_rcp_update:
77
version: "~1.4.0"
88
esp_br_http_ota:

0 commit comments

Comments
 (0)