From e411e43b4b858c41f0eb12aa8512412adf56d0bb Mon Sep 17 00:00:00 2001 From: jgujarathi Date: Mon, 1 Jul 2024 12:18:43 +0530 Subject: [PATCH] fix(examples) : Common component's wifi disconnect handler should ignore roaming disconnect - Common component's wifi disconnect handler should ignore roaming disconnect (WIFI_REASON_ROAMING) as connect gets issued internally in these cases. --- .../protocol_examples_common/wifi_connect.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/common_components/protocol_examples_common/wifi_connect.c b/examples/common_components/protocol_examples_common/wifi_connect.c index ed95bccb2f..1bfc1b35f4 100644 --- a/examples/common_components/protocol_examples_common/wifi_connect.c +++ b/examples/common_components/protocol_examples_common/wifi_connect.c @@ -46,7 +46,12 @@ static void example_handler_on_wifi_disconnect(void *arg, esp_event_base_t event example_wifi_sta_do_disconnect(); return; } - ESP_LOGI(TAG, "Wi-Fi disconnected, trying to reconnect..."); + wifi_event_sta_disconnected_t *disconn = event_data; + if (disconn->reason == WIFI_REASON_ROAMING) { + ESP_LOGD(TAG, "station roaming, do nothing"); + return; + } + ESP_LOGI(TAG, "Wi-Fi disconnected %d, trying to reconnect...", disconn->reason); esp_err_t err = esp_wifi_connect(); if (err == ESP_ERR_WIFI_NOT_STARTED) { return;