Auto-reconnect to the WiFi using Captive Portal example

Hi,
I'm working with an ESP12F. I was earlier working on the DNSServer example of Captive Portal Advanced, for which I'll leave the link [here].(Arduino/libraries/DNSServer/examples/CaptivePortalAdvanced at master · esp8266/Arduino · GitHub)

So while I was working on this I realized that even if I reset or reboot the ESP, it would automatically reconnect to the WiFi. But I have changed the code slightly to match a project that I'm working on. (Unfortunately, I'm not allowed to post the code).
So this code does not automatically reconnect to the WiFi. Something that I noticed from the messages displayed on the Serial Monitor is that when rebooting the ESP while the original code is being executed, the ESP is not resetting. It connects to the WiFi again and carries on from where it left.
But in the code that I modified, when I reboot/ reset, the code starts to execute all over from the beginning. (Which I believe why the ESP doesn't connect again automatically).
I need the code to automatically reconnect to the WiFi.
Really appreciate any pointers to what I could look out for.
(Really sorry about the fact that I cannot post the code!)

Thank you!

Then post an MRE. This is the smallest possible code that compiles and demonstrates the problem at hand. Leave out anything unrelated to the problem.

The code is pretty long, and I'm not sure which part causes the problem. But I'd appreciate if 'what makes the original code not reset after rebooting or resetting' could be explained.
Thank you!

You might learn just that as you start paring down your large code to a minimal design.

Thank you! I figured it out!

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