diff --git a/examples/common_components/protocol_examples_common/eth_connect.c b/examples/common_components/protocol_examples_common/eth_connect.c index 8e89dbe28e..b7d792f360 100644 --- a/examples/common_components/protocol_examples_common/eth_connect.c +++ b/examples/common_components/protocol_examples_common/eth_connect.c @@ -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; } diff --git a/examples/common_components/protocol_examples_common/wifi_connect.c b/examples/common_components/protocol_examples_common/wifi_connect.c index ed95bccb2f..8d5c815a85 100644 --- a/examples/common_components/protocol_examples_common/wifi_connect.c +++ b/examples/common_components/protocol_examples_common/wifi_connect.c @@ -166,10 +166,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;