WiFiManager icon indicating copy to clipboard operation
WiFiManager copied to clipboard

Question: proper use of autoConnect

Open ChumKiu opened this issue 5 months ago • 0 comments

I'm using an ESP32 WROOM32 module, my system can be used away from the WiFi acces point so the connection can be lost, but after some time the module is again into the Access Point range and have to reconnect to the Access Point stored credentials automatically. Now in my loop() method I handle the reconnection task in this way, but I'm not sure if this is the proper way:

// -------------------------------------------------- // WiFi connection monitor // If WiFi is down try to reconnect // --------------------------------------------------

curWiFiMillis = millis(); if ( (WiFi.status() != WL_CONNECTED) && (curWiFiMillis - prevWiFiMillis >= WiFiCheckInterval)) { Serial.println("(Main) Reconnecting to WiFi..."); //WiFi.disconnect(); //WiFi.reconnect(); wm.autoConnect(); prevWiFiMillis = curWiFiMillis; }

so the expected behavior should be when the Access Point is again available (module is again near the Access Point) the module should be reconnect in automatic way and then I should be able to reconnect it through websocket from the client code that is running on a Raspberry computer board linked to same SSID Wi-Fi network.

I'm using the autoConnect() feature in a proper way or I've to use another approach?

Thanks for clarification. BR

ChumKiu avatar Jul 24 '25 12:07 ChumKiu