WiFiManager Time Question

After numerous setbacks I finally have most of my code working.
The problem is that it times out after about a minute, and I would like no timeout.
This is mostly taken from the example under "WiFiManagerNonBlocking, and is as follows.
All I have added is the "while" loop.

// 
//  Below is fine, provided a network is selected within about a minute.
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
WiFiManager wm;

void setup() {
  WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
  // put your setup code here, to run once:
  Serial.begin(115200);

  //reset settings - wipe credentials for testing
  //wm.resetSettings();

  wm.setConfigPortalBlocking(false);
  wm.setConfigPortalTimeout(600000); // Originally 60, but makes no difference
  //automatically connect using saved credentials if they exist
  //If connection fails it starts an access point with the specified name
  if (wm.autoConnect("AutoConnectAP")) {
    Serial.println("connected...yeey :)");
  }
  else {
    Serial.println("Configportal running");

    while (WiFi.status() != WL_CONNECTED) {

      // FLASH RED/GREEN LEDS
      Serial.println("======== start flash ===========================");
      pinMode( 13, OUTPUT );   // Green LED
      pinMode( 15, OUTPUT);    //  Red  LED

      for (int  i = 100; i >= 0; i--) { // do it 50 times, or about 7 second!
        wm.process();
        //Turn Red On and green off; then reverse; 0.1 sec/cycle
        digitalWrite(15, HIGH); // Red
        digitalWrite(13, LOW ); // Green
        delay(90);
        digitalWrite(13, HIGH); // Green
        digitalWrite(15, LOW ); // Red
        delay(90);

      } // end of flash for
    } // end while
  } // end else
} // end setup

void loop() {
  wm.process();
  // put your main code here, to run repeatedly:
}

I have added a "while" loop if no network is found and "ConfigPortal" is running..
I flash the LEDs to alert the user to do something.
I also don't understand the line " wm.process();" - but this seems to be needed.

All I need is a command to allow more time for configuration.

you want the config portal to run all the time?

I think so.
I want it to run until a network is selected.
Once I select a network all seems to go OK.
However, after about a minute I no longer see "AutoConnectAP" on my cellphone screen.
During the time it appears everything runs OK. Once it goes away I'm stuck!

Problem solved!
Sorry about that.
Setting ConfigPortalTimeput to 600000 should have allow me ten minutes.
HOWEVER - when I tested after only a minute or two, it reset so that after that the config mode was exited.
Being more patient, and waiting before testing for a network, the reset is NOT triggered, and all works fine!

Thanks to anyone who read this.
- Matt

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.