WiFiManager
WiFiManager copied to clipboard
setConfigPortalTimeout not timing out the portal bug?
idk if its just me doing it wrong or if this is a bug, but i noticed setConfigPortalTimeout will not work for me and the portal just keeps running, am i the only one with this problem?
i have not tried to figure out why (yet), but i tried making a custom timeout and that will close the portal, but without it, the portal will just keep running forever.
here is some relevant code, maybe i missed something: (wifisetup is called in setup and open_portal is called when i need the portal)
void open_portal() {
wifiManager.setConfigPortalTimeout(300);
// wifiManager.setConfigPortalBlocking(false);
wifiManager.setWebPortalClientCheck(true);
wifiManager.startWebPortal();
while (startPortal) {
// if (!wifiManager.getWebPortalActive() || millis() - portalstarttime > PORTALTIMEOUT) startPortal = false;
if (!wifiManager.getWebPortalActive()) startPortal = false;
if (mqttclient.connected()) {mqttclient.loop();} else {mqttreconnect();}
setGPIO();
wifiManager.process();
}
wifiManager.stopWebPortal();
mqttSendValues();
}
void wifisetup(){
// Connect to Wi-Fi
wifiManager.setDebugOutput(false);
const char* menuhtml = "<form action='/settings' method='get'><button>Bulb setup</button></form><br/>\n";
wifiManager.setCustomMenuHTML(menuhtml);
wifiManager.setTitle("Bulb portal:");
wifiManager.setDarkMode(true); // invert theme, dark
wifiManager.setWebServerCallback(bindServerCallback);
wifiManager.setConfigResetCallback(handleReset);
wifiManager.setPreOtaUpdateCallback(handleOTA);
wifiManager.setWebPortalClientCheck(false);
wifiManager.setScanDispPerc(true); // show RSSI as percentage not graph icons
std::vector<const char *> wm_menu = {"wifi","wifinoscan","sep","custom","sep","update","info","sep","restart","exit"};
wifiManager.setMenu(wm_menu);
wifiManager.setAPStaticIPConfig(IPAddress(4,3,2,1), IPAddress(4,3,2,1), IPAddress(255,255,255,0));
wifiManager.setConfigPortalBlocking(false);
// wifiManager.setConfigPortalTimeout(300);
wifiManager.setWiFiAutoReconnect(true);
wifiManager.setHostname(APNAME);
if(!wifiManager.autoConnect(APNAME, APPASS)) {
while(WiFi.status() != WL_CONNECTED){
setGPIO();
wifiManager.process();
}
rebootESP("WiFi Connected");
}
}
configportaltimeout does not work on webportal, nor non blocking I think. There has been a request or 2 to enable it. I would have to find that issue and take a look