mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
Merge branch 'feat/support_wifi_infinite_retry_v5.2' into 'release/v5.2'
feat(protocol_examples_common): support infinite retries for example_handler_on_wifi_disconnect (v5.2) See merge request espressif/esp-idf!46673
This commit is contained in:
@@ -46,6 +46,7 @@ menu "Example Connection Configuration"
|
||||
help
|
||||
Set the Maximum retry to avoid station reconnecting to the AP unlimited,
|
||||
in case the AP is really inexistent.
|
||||
Set to -1 for infinite retries.
|
||||
|
||||
choice EXAMPLE_WIFI_SCAN_METHOD
|
||||
prompt "WiFi Scan Method"
|
||||
|
||||
@@ -32,7 +32,7 @@ static void example_handler_on_wifi_disconnect(void *arg, esp_event_base_t event
|
||||
int32_t event_id, void *event_data)
|
||||
{
|
||||
s_retry_num++;
|
||||
if (s_retry_num > CONFIG_EXAMPLE_WIFI_CONN_MAX_RETRY) {
|
||||
if (CONFIG_EXAMPLE_WIFI_CONN_MAX_RETRY >= 0 && s_retry_num > CONFIG_EXAMPLE_WIFI_CONN_MAX_RETRY) {
|
||||
ESP_LOGI(TAG, "WiFi Connect failed %d times, stop reconnect.", s_retry_num);
|
||||
/* let example_wifi_sta_do_connect() return */
|
||||
if (s_semph_get_ip_addrs) {
|
||||
@@ -171,7 +171,7 @@ esp_err_t example_wifi_sta_do_connect(wifi_config_t wifi_config, bool wait)
|
||||
#if CONFIG_EXAMPLE_CONNECT_IPV6
|
||||
xSemaphoreTake(s_semph_get_ip6_addrs, portMAX_DELAY);
|
||||
#endif
|
||||
if (s_retry_num > CONFIG_EXAMPLE_WIFI_CONN_MAX_RETRY) {
|
||||
if (CONFIG_EXAMPLE_WIFI_CONN_MAX_RETRY >= 0 && s_retry_num > CONFIG_EXAMPLE_WIFI_CONN_MAX_RETRY) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user