This commit is contained in:
Steffen Beyer 2024-09-15 12:46:32 +08:00 committed by GitHub
commit 63870f61e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -232,10 +232,14 @@ esp_err_t example_ethernet_connect(void)
eth_start();
ESP_LOGI(TAG, "Waiting for IP(s).");
#if CONFIG_EXAMPLE_CONNECT_IPV4
xSemaphoreTake(s_semph_get_ip_addrs, portMAX_DELAY);
if (xSemaphoreTake(s_semph_get_ip_addrs, pdMS_TO_TICKS(10000)) == pdFALSE) {
ESP_LOGW(TAG, "Gave up waiting for IPv4 address.");
}
#endif
#if CONFIG_EXAMPLE_CONNECT_IPV6
xSemaphoreTake(s_semph_get_ip6_addrs, portMAX_DELAY);
if (xSemaphoreTake(s_semph_get_ip6_addrs, pdMS_TO_TICKS(10000)) == pdFALSE) {
ESP_LOGW(TAG, "Gave up waiting for (preferred) IPv6 address.");
}
#endif
return ESP_OK;
}

View File

@ -171,10 +171,14 @@ esp_err_t example_wifi_sta_do_connect(wifi_config_t wifi_config, bool wait)
if (wait) {
ESP_LOGI(TAG, "Waiting for IP(s)");
#if CONFIG_EXAMPLE_CONNECT_IPV4
xSemaphoreTake(s_semph_get_ip_addrs, portMAX_DELAY);
if (xSemaphoreTake(s_semph_get_ip_addrs, pdMS_TO_TICKS(10000)) == pdFALSE) {
ESP_LOGW(TAG, "Gave up waiting for IPv4 address.");
}
#endif
#if CONFIG_EXAMPLE_CONNECT_IPV6
xSemaphoreTake(s_semph_get_ip6_addrs, portMAX_DELAY);
if (xSemaphoreTake(s_semph_get_ip6_addrs, pdMS_TO_TICKS(10000)) == pdFALSE) {
ESP_LOGW(TAG, "Gave up waiting for (preferred) IPv6 address.");
}
#endif
if (s_retry_num > CONFIG_EXAMPLE_WIFI_CONN_MAX_RETRY) {
return ESP_FAIL;