[GH-ISSUE #1645] autoConnect is blocking despite setConfigPortalBlocking(false) #1401

Open
opened 2026-02-28 01:29:55 +03:00 by kerem · 2 comments
Owner

Originally created by @entozoon on GitHub (Aug 9, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1645

Is it possible to run other things while autoConnect attempts to connect to wifi?
I don't want my device to just freeze up while it tries to connect.

Basic Infos

Hardware

WiFimanager Branch/Release: Master

Esp8266/Esp32: Esp32

Description

Problem description

#include <WiFiManager.h>
WiFiManager wm;
void setupWifi() {  
  wm.setConfigPortalBlocking(false);
  wm.setConnectTimeout(180);
  wm.setConfigPortalTimeout(180); 
  Serial.println("Wifi starting");
  while (!wm.autoConnect()) {
    Serial.println("?"); // No output
    delay(50);
  }
} 
void setup() {
  Serial.begin(115200);
  delay(3000);
  setupWifi();
} 
void loop() {
  wm.process();
  Serial.println("Loop"); // Doesn't reach here til after wifi connects
}

Debug Messages

Wifi starting
*wm:AutoConnect 
*wm:Connecting to SAVED AP: My House

It hangs here while attempting to connect (which can take ages as I have a weak signal) but ideally I'd flash an LED or whatever while it tries.

Originally created by @entozoon on GitHub (Aug 9, 2023). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1645 Is it possible to run other things while autoConnect attempts to connect to wifi? I don't want my device to just freeze up while it tries to connect. ### Basic Infos #### Hardware WiFimanager Branch/Release: Master Esp8266/Esp32: Esp32 ### Description Problem description ```cpp #include <WiFiManager.h> WiFiManager wm; void setupWifi() { wm.setConfigPortalBlocking(false); wm.setConnectTimeout(180); wm.setConfigPortalTimeout(180); Serial.println("Wifi starting"); while (!wm.autoConnect()) { Serial.println("?"); // No output delay(50); } } void setup() { Serial.begin(115200); delay(3000); setupWifi(); } void loop() { wm.process(); Serial.println("Loop"); // Doesn't reach here til after wifi connects } ``` ### Debug Messages ``` Wifi starting *wm:AutoConnect *wm:Connecting to SAVED AP: My House ``` It hangs here while attempting to connect (which can take ages as I have a weak signal) but ideally I'd flash an LED or whatever while it tries.
Author
Owner

@tablatronix commented on GitHub (Aug 10, 2023):

Yeah the actual connection is blocking, there is another issue for this already I think. I will have to add callbacks or something, you really cannot be doing anything in code when waiting for connection as it can affect it. I think I can add a return and a callback when connected or status change etc.

I have never tried a fire and forget wifi begin...

<!-- gh-comment-id:1673242980 --> @tablatronix commented on GitHub (Aug 10, 2023): Yeah the actual connection is blocking, there is another issue for this already I think. I will have to add callbacks or something, you really cannot be doing anything in code when waiting for connection as it can affect it. I think I can add a return and a callback when connected or status change etc. I have never tried a fire and forget wifi begin...
Author
Owner

@SiddiqueAhmad commented on GitHub (Sep 16, 2023):

any chance ? We need to run load and battery lights, but it get stuck in connecting

<!-- gh-comment-id:1722208090 --> @SiddiqueAhmad commented on GitHub (Sep 16, 2023): any chance ? We need to run load and battery lights, but it get stuck in connecting
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1401
No description provided.