Initialize wifi manager on failed connection

If I remember correctly I remember seeing a section in the main loop about the wifi manager and AP mode starting again after X failed attempts to connect. About that:

  1. I don’t see that happening on my device when it can’t connect to my wifi, what are the conditions?
  2. When I want to change networks I have to flash again with “erase flash” option, or by declaring the clear SPIFFS option in the code. There’s this nice module I’ve been using lately to enter my devices into configuration modes, it checks if a manual reset was done twice quickly (basically double clicking the reset button), and then initializes the configuration mode. What do you think about integrating it into OMG?
  3. I think also enabling the WEBUI for wifi/mqtt settings once successfully connected to wifi, but failed mqtt connection X Times would be useful for many new users

The behaviour is dependent on the fact that there was already a successfull connection to the broker. since the ESP start.

If it was the case we loop on trying to connect indefintely. The goal is to enable the auto reconnection following broker failures or restart.
IT has been discussed below:


and below:

It could be nice to incorporate that, do you have some example to indicates?

Maybe we could try to enable the webui permanently

Sorry, I didn’t see those bugs as I’ve been away from the forum for a while. My issue was more wifi related, than mqtt broker related though, as I frequently move the OMG between my work and home to tinker.

I got some examples using it, but theres a good one in the creator’s GitHub. The library is called DoubleResetDetector, and it’s basically just defining an instance with the timeout for double clicking, and the address to save the variable in the rtc memory. Then checking if there was a double reset using the detectDoubleReset function in the setup. Just 2 lines, but very useful.

Enabling the webUi permenantly will take some resources, wouldn’t it? I think on mqtt error is enough, or maybe add another define in the code, like EnablePersistantWebUI or something. What do you think?

Thanks for the idea, I found this:

Is it the one you are talking about?

I don’t know, I have never studied this “field” of the esp.

I will begin by the detection of double reset and we will see for the rest

Yep, that’s the one.
Sounds good :+1: