[GH-ISSUE #833] Access Point remains visible after a successful autoConnect() #697

Open
opened 2026-02-28 01:26:37 +03:00 by kerem · 1 comment
Owner

Originally created by @sglvladi on GitHub (Feb 22, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/833

Basic Infos

Hardware

WiFimanager Branch/Release:

  • Master
  • Development

Esp8266/Esp32:

  • ESP8266
  • ESP32

Hardware: ESP-12e, esp01, esp25

  • ESP01
  • ESP12 E/F/S (nodemcu, wemos, feather)
  • Other

ESP Core Version: 2.4.0, staging

  • 2.3.0
  • 2.4.0
  • staging (master/dev)

Description

From time to time, I can observe that, once a given ESP8266 has successfully connected to a network, the WM Access Point is still visible (and connectable), but the WebServer is not running (trying to access 192.168.4.1 doesn't return the WM web page). Just as a note, the desireable functionality would be to enter STA mode, i.e. no AP should be visible, which I think should be what happens when a simple autoConnect() call is made.

What is very interesting is that the issue doesn't seem to happen with all ESPs and it is also not dependent on the ESP Core Version. I have tried loading the same sketches/projects to identical devices, and some will exhibit the issues, while others will not. However, if a device does exhibit the problem, it will keep exhibiting it forever, irrespective of what version of the Arduino core is running.

Settings in IDE

Module: NodeMcu, Wemos D1

Additional libraries:

Sketch

The sketch I am using is pretty massive and contains a few custom defined libraries, however none of them perform any operations on the Wifi. Essentially, on every loop the sketch will check to see if the device is still connected to an AP, and if not it will make a call to the WiFiManager.autoConnect() method.

Thus, here's a summary of the sketch:


#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266WebServer.h>
.... (& more)

void setup() {
...
    String apName = "SomeAPname";
    String apPass = "SomeAPpass";
    std::vector<const char *> menu = {"wifi", "info", "restart", "exit"};
    wifiManager.setMenu(menu);
    wifiManager.autoConnect(apName.c_str(), apPass.c_str());
...
}

void loop() {
....
    if (WiFi.status() != WL_CONNECTED)
    {
        WiFi.disconnect();
        Serial.println("Connection to WiFi has been lost. Attempting to reconnect....");
        wifiManager.autoConnect(apName.c_str(), apPass.c_str());
    }
....
}

I am not sure exactly why I have the WiFi.disconnect(); in there, but I can vaguely remember that it was added at some point "just" to be sure that we have disconnected from the network, before attempting any reconnections/etc.. I doubt that this would be causing any issues, but seeing as this is the only command that operates on the Wifi, other that WM itself, I thought I would make a not of it.

Debug Messages

There is no (easily) identifiable debugging relating to this issue (for now)..

Thanks much in advance.

Originally created by @sglvladi on GitHub (Feb 22, 2019). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/833 ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [ ] Master - [x] Development **Esp8266/Esp32:** - [x] ESP8266 - [ ] ESP32 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [x] ESP12 E/F/S (nodemcu, wemos, feather) - [ ] Other **ESP Core Version: 2.4.0, staging** - [ ] 2.3.0 - [x] 2.4.0 - [ ] staging (master/dev) ### Description From time to time, I can observe that, once a given ESP8266 has successfully connected to a network, the WM Access Point is still visible (and connectable), but the WebServer is not running (trying to access 192.168.4.1 doesn't return the WM web page). Just as a note, the desireable functionality would be to enter STA mode, i.e. no AP should be visible, which I think should be what happens when a simple autoConnect() call is made. What is very interesting is that the issue doesn't seem to happen with all ESPs and it is also not dependent on the ESP Core Version. I have tried loading the same sketches/projects to identical devices, and some will exhibit the issues, while others will not. However, if a device does exhibit the problem, it will keep exhibiting it forever, irrespective of what version of the Arduino core is running. ### Settings in IDE Module: NodeMcu, Wemos D1 Additional libraries: ### Sketch The sketch I am using is pretty massive and contains a few custom defined libraries, however none of them perform any operations on the Wifi. Essentially, on every loop the sketch will check to see if the device is still connected to an AP, and if not it will make a call to the WiFiManager.autoConnect() method. Thus, here's a summary of the sketch: ```cpp #include <Arduino.h> #include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #include <ESP8266WebServer.h> .... (& more) void setup() { ... String apName = "SomeAPname"; String apPass = "SomeAPpass"; std::vector<const char *> menu = {"wifi", "info", "restart", "exit"}; wifiManager.setMenu(menu); wifiManager.autoConnect(apName.c_str(), apPass.c_str()); ... } void loop() { .... if (WiFi.status() != WL_CONNECTED) { WiFi.disconnect(); Serial.println("Connection to WiFi has been lost. Attempting to reconnect...."); wifiManager.autoConnect(apName.c_str(), apPass.c_str()); } .... } ``` I am not sure exactly why I have the ```WiFi.disconnect();``` in there, but I can vaguely remember that it was added at some point "just" to be sure that we have disconnected from the network, before attempting any reconnections/etc.. I doubt that this would be causing any issues, but seeing as this is the only command that operates on the Wifi, other that WM itself, I thought I would make a not of it. ### Debug Messages There is no (easily) identifiable debugging relating to this issue (for now).. Thanks much in advance.
Author
Owner

@tablatronix commented on GitHub (Feb 22, 2019):

just set the mode to sta in your code, something has remembered softap default flash

<!-- gh-comment-id:466580488 --> @tablatronix commented on GitHub (Feb 22, 2019): just set the mode to sta in your code, something has remembered softap default flash
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#697
No description provided.