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.
This commit is contained in:
jgujarathi 2024-07-01 12:18:43 +05:30 committed by BOT
parent 6547315dde
commit e411e43b4b

View File

@ -46,7 +46,12 @@ static void example_handler_on_wifi_disconnect(void *arg, esp_event_base_t event
example_wifi_sta_do_disconnect(); example_wifi_sta_do_disconnect();
return; 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(); esp_err_t err = esp_wifi_connect();
if (err == ESP_ERR_WIFI_NOT_STARTED) { if (err == ESP_ERR_WIFI_NOT_STARTED) {
return; return;