Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wm.setConfigPortalBlocking(false) + big delay = not working #1761

Open
Jehn84 opened this issue Aug 21, 2024 · 2 comments
Open

wm.setConfigPortalBlocking(false) + big delay = not working #1761

Jehn84 opened this issue Aug 21, 2024 · 2 comments

Comments

@Jehn84
Copy link

Jehn84 commented Aug 21, 2024

I'm trying to use the library in my project. An implementation with wm.setConfigPortalBlocking(false) is needed, but when a large delay is used in the loop, the portal either does not work at all, or it freezes very much and the web interface does not load. What can be done?

For example:

#include <WiFiManager.h>
WiFiManager wm;

void setup() {
    WiFi.mode(WIFI_STA); 
    Serial.begin(9600);
    wm.resetSettings();
    wm.setConfigPortalBlocking(false);
    wm.setConfigPortalTimeout(600);
    if(wm.autoConnect("TEST-AP")){
        Serial.println("connected...yeey :)");
    }
    else {
        Serial.println("Configportal running");
    }
}

void loop() {
    wm.process();
    Serial.print(".");
    delay(60000);
}
@Chalta
Copy link

Chalta commented Sep 6, 2024

The wm.process needs to run continuously. It can't just run once and then "not run" for 60000 ms. A hint is how often you get the heartbeat "." printed to your serial monitor.

You need to set up a non-blocking timer in loop() using a while or an if statement, and/or process a callback from wifi manager when the captive portal returns a result. See the example sketches in this repository.

@tablatronix
Copy link
Collaborator

What they said

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants