[GH-ISSUE #545] Server not working after portal connection. Only after manual reset. #457

Open
opened 2026-02-28 01:25:24 +03:00 by kerem · 50 comments
Owner

Originally created by @jwktje on GitHub (Mar 3, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/545

Basic Infos

Webserver responses only work on a reset after successfully connecting to a Wifi Network via the portal.

Hardware

WiFimanager Branch/Release: ESP32

Hardware: ESP32 (Wemos Lolin32)

Description

I'm using the bbx10 webserver and the ESP32 branch of WifiManager. Everything works great and stable since running these versions. But my only problem is that my server responses get a ERR_CONNECTION_REFUSED. When I reset the module and it already has the credentials, everything runs fine.

Sketch

//Init webserver
WebServer server(80);

void setup() {
  
  //Begin Serial
  Serial.begin(115200);
 
  //Manager setup
  WiFiManager wifiManager;
  wifiManager.setBreakAfterConfig(true);
  //wifiManager.resetSettings();
  
  if (!wifiManager.autoConnect("ConfigureWifi")) {
    Serial.println("failed to connect and hit timeout");
    delay(3000);
    //reset and try again
    ESP.restart();
    delay(5000);
  }

  Serial.print ( "Connected with IP address: " );
  Serial.println ( WiFi.localIP() );

  server.begin();
  
  server.on("/", handle_root);

Debug Messages

*WM: Free heap:  139096
*WM: ESP-IDF version:  v3.1-dev-239-g1c3dd23f-dirty
*WM: freeing allocated params!
*WM: unloading
*WM: -> captive.apple.com
*WM: <- Request redirected to captive portal
*WM: <- HTTP Root
*WM: -> 192.168.4.1
*WM: -> captive.apple.com
*WM: <- Request redirected to captive portal
*WM: <- HTTP Root
*WM: -> 192.168.4.1
*WM: -> captive.apple.com
*WM: <- Request redirected to captive portal
*WM: <- HTTP Root
*WM: -> 192.168.4.1
*WM: -> captive.apple.com
*WM: <- Request redirected to captive portal
*WM: <- HTTP Wifi
*WM: Free heap:  132700
*WM: ESP-IDF version:  v3.1-dev-239-g1c3dd23f-dirty
*WM: freeing allocated params!
*WM: unloading
*WM: Free heap:  132708
*WM: ESP-IDF version:  v3.1-dev-239-g1c3dd23f-dirty
*WM: freeing allocated params!
*WM: unloading
*WM: Scan done
*WM: AP:  -52 Network-redacted
*WM: AP:  -79 Network-redacted
*WM: AP:  -91 Network-redacted
*WM: Sent config page
*WM: <- HTTP Root
*WM: -> 192.168.4.1
*WM: -> captive.apple.com
*WM: <- Request redirected to captive portal
*WM: <- HTTP Root
*WM: -> 192.168.4.1
*WM: NUM CLIENTS: 1
*WM: -> captive.apple.com
*WM: <- Request redirected to captive portal
*WM: <- HTTP WiFi save 
*WM: Method: POST
*WM: Sent wifi save page
*WM: Connecting to a new AP
*WM: Connecting as wifi client...
*WM: wifi station disconnect
*WM: Connecting to new AP
*WM: connectTimeout not set, ESP waitForConnectResult...
*WM: Free heap:  131700
*WM: ESP-IDF version:  v3.1-dev-239-g1c3dd23f-dirty
*WM: freeing allocated params!
*WM: unloading
*WM: Free heap:  132008
*WM: ESP-IDF version:  v3.1-dev-239-g1c3dd23f-dirty
*WM: freeing allocated params!
*WM: unloading
*WM: Connection result: WL_CONNECTED
*WM: Connect to new AP [SUCCESS]
*WM: Got IP Address:
*WM: 192.168.2.23
*WM: disconnect configportal
*WM: disconnect configportal - softAPdisconnect failed
*WM: Free heap:  145384
*WM: ESP-IDF version:  v3.1-dev-239-g1c3dd23f-dirty
*WM: freeing allocated params!
*WM: unloading
*WM: Free heap:  145580
*WM: ESP-IDF version:  v3.1-dev-239-g1c3dd23f-dirty
*WM: freeing allocated params!
*WM: unloading
*WM: config portal exiting
Connected with IP address: 192.168.2.23
Originally created by @jwktje on GitHub (Mar 3, 2018). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/545 ### Basic Infos Webserver responses only work on a reset after successfully connecting to a Wifi Network via the portal. #### Hardware WiFimanager Branch/Release: ESP32 Hardware: ESP32 (Wemos Lolin32) ### Description I'm using the bbx10 webserver and the ESP32 branch of WifiManager. Everything works great and stable since running these versions. But my only problem is that my server responses get a ERR_CONNECTION_REFUSED. When I reset the module and it already has the credentials, everything runs fine. ### Sketch ``` //Init webserver WebServer server(80); void setup() { //Begin Serial Serial.begin(115200); //Manager setup WiFiManager wifiManager; wifiManager.setBreakAfterConfig(true); //wifiManager.resetSettings(); if (!wifiManager.autoConnect("ConfigureWifi")) { Serial.println("failed to connect and hit timeout"); delay(3000); //reset and try again ESP.restart(); delay(5000); } Serial.print ( "Connected with IP address: " ); Serial.println ( WiFi.localIP() ); server.begin(); server.on("/", handle_root); ``` ### Debug Messages ``` *WM: Free heap: 139096 *WM: ESP-IDF version: v3.1-dev-239-g1c3dd23f-dirty *WM: freeing allocated params! *WM: unloading *WM: -> captive.apple.com *WM: <- Request redirected to captive portal *WM: <- HTTP Root *WM: -> 192.168.4.1 *WM: -> captive.apple.com *WM: <- Request redirected to captive portal *WM: <- HTTP Root *WM: -> 192.168.4.1 *WM: -> captive.apple.com *WM: <- Request redirected to captive portal *WM: <- HTTP Root *WM: -> 192.168.4.1 *WM: -> captive.apple.com *WM: <- Request redirected to captive portal *WM: <- HTTP Wifi *WM: Free heap: 132700 *WM: ESP-IDF version: v3.1-dev-239-g1c3dd23f-dirty *WM: freeing allocated params! *WM: unloading *WM: Free heap: 132708 *WM: ESP-IDF version: v3.1-dev-239-g1c3dd23f-dirty *WM: freeing allocated params! *WM: unloading *WM: Scan done *WM: AP: -52 Network-redacted *WM: AP: -79 Network-redacted *WM: AP: -91 Network-redacted *WM: Sent config page *WM: <- HTTP Root *WM: -> 192.168.4.1 *WM: -> captive.apple.com *WM: <- Request redirected to captive portal *WM: <- HTTP Root *WM: -> 192.168.4.1 *WM: NUM CLIENTS: 1 *WM: -> captive.apple.com *WM: <- Request redirected to captive portal *WM: <- HTTP WiFi save *WM: Method: POST *WM: Sent wifi save page *WM: Connecting to a new AP *WM: Connecting as wifi client... *WM: wifi station disconnect *WM: Connecting to new AP *WM: connectTimeout not set, ESP waitForConnectResult... *WM: Free heap: 131700 *WM: ESP-IDF version: v3.1-dev-239-g1c3dd23f-dirty *WM: freeing allocated params! *WM: unloading *WM: Free heap: 132008 *WM: ESP-IDF version: v3.1-dev-239-g1c3dd23f-dirty *WM: freeing allocated params! *WM: unloading *WM: Connection result: WL_CONNECTED *WM: Connect to new AP [SUCCESS] *WM: Got IP Address: *WM: 192.168.2.23 *WM: disconnect configportal *WM: disconnect configportal - softAPdisconnect failed *WM: Free heap: 145384 *WM: ESP-IDF version: v3.1-dev-239-g1c3dd23f-dirty *WM: freeing allocated params! *WM: unloading *WM: Free heap: 145580 *WM: ESP-IDF version: v3.1-dev-239-g1c3dd23f-dirty *WM: freeing allocated params! *WM: unloading *WM: config portal exiting Connected with IP address: 192.168.2.23 ```
Author
Owner

@jwktje commented on GitHub (Mar 3, 2018):

I found this gist but the BBX10 webserver misses this function it seems.
https://gist.github.com/tzapu/ecc0759829d30d5a6152

<!-- gh-comment-id:370144540 --> @jwktje commented on GitHub (Mar 3, 2018): I found this gist but the BBX10 webserver misses this function it seems. https://gist.github.com/tzapu/ecc0759829d30d5a6152
Author
Owner

@tablatronix commented on GitHub (Mar 3, 2018):

what is in your loop ?
*WM: unloading this means your deconstructor is running, why is the class init and deinit over and over?

Are there reboots in there?

<!-- gh-comment-id:370154501 --> @tablatronix commented on GitHub (Mar 3, 2018): what is in your loop ? `*WM: unloading` this means your deconstructor is running, why is the class init and deinit over and over? Are there reboots in there?
Author
Owner

@jwktje commented on GitHub (Mar 3, 2018):

My loop is this:

timer.run(); //Run non-wifi related timed functions
timeClient.update(); //For updating the NTP time i'm using
  handleTheButton(); //Handling button inputs, not wifi related
  handleTheClient(); //Only wifi related function

The only relevant piece in my code is just calling this:

server.handleClient();

Other functions don't do wifi related calls as far as I know. At the very least it doesn't use the wifi manager functions so I'm confused as to where the *WM: Unloading comes from

UPDATE:

Just added some extra Serial prints, and the following logs happen automatically between the last line of my Setup() and the first Loop call:

*WM: freeing allocated params!
*WM: unloading
<!-- gh-comment-id:370162831 --> @jwktje commented on GitHub (Mar 3, 2018): My loop is this: ``` timer.run(); //Run non-wifi related timed functions timeClient.update(); //For updating the NTP time i'm using handleTheButton(); //Handling button inputs, not wifi related handleTheClient(); //Only wifi related function ``` The only relevant piece in my code is just calling this: ``` server.handleClient(); ``` Other functions don't do wifi related calls as far as I know. At the very least it doesn't use the wifi manager functions so I'm confused as to where the `*WM: Unloading` comes from UPDATE: Just added some extra Serial prints, and the following logs happen automatically between the last line of my Setup() and the first Loop call: ``` *WM: freeing allocated params! *WM: unloading ```
Author
Owner

@tablatronix commented on GitHub (Mar 3, 2018):

try the latest commit

<!-- gh-comment-id:370163383 --> @tablatronix commented on GitHub (Mar 3, 2018): try the latest commit
Author
Owner

@jwktje commented on GitHub (Mar 3, 2018):

Which branch? I'm on ESP32 now and pulled yesterday

<!-- gh-comment-id:370163546 --> @jwktje commented on GitHub (Mar 3, 2018): Which branch? I'm on ESP32 now and pulled yesterday
Author
Owner

@tablatronix commented on GitHub (Mar 3, 2018):

is it possible the webserver just doesn't support instances properly ?
can you create 2 webservers in your own scopes, without wifimanager?

<!-- gh-comment-id:370163699 --> @tablatronix commented on GitHub (Mar 3, 2018): is it possible the webserver just doesn't support instances properly ? can you create 2 webservers in your own scopes, without wifimanager?
Author
Owner

@jwktje commented on GitHub (Mar 3, 2018):

Maybe yeah. I'm not fully up to speed on how the WebServer lib handles things. The gist I commented is for ESP8266 and the respective WebServer which has a reset function apparently.

Could I simulate this function somehow myself without changing the BBX10 Lib? As the Lib functions fine otherwise

<!-- gh-comment-id:370163998 --> @jwktje commented on GitHub (Mar 3, 2018): Maybe yeah. I'm not fully up to speed on how the WebServer lib handles things. The gist I commented is for ESP8266 and the respective WebServer which has a reset function apparently. Could I simulate this function somehow myself without changing the BBX10 Lib? As the Lib functions fine otherwise
Author
Owner

@tablatronix commented on GitHub (Mar 3, 2018):

reset() is not part of the library, is a smart pointer method.

std::unique_ptr<ESP8266WebServer> server;
server.reset(new ...)
<!-- gh-comment-id:370164120 --> @tablatronix commented on GitHub (Mar 3, 2018): reset() is not part of the library, is a smart pointer method. ```c++ std::unique_ptr<ESP8266WebServer> server; server.reset(new ...) ```
Author
Owner

@jwktje commented on GitHub (Mar 3, 2018):

Ah right! So that's where my confusion came from. Thought is was a lib function. I'll rewrite all my dot notation calls to instance calls and see if that works! Good catch.

Update:
Rewrote all calls to reflect the Gist entirely and the sketch compiles and runs. But the problem still remains sadly. Going to a route in Chrome still gives ERR_CONNECTION_REFUSED after setting up via the portal without actually pressing the reset button on the device. I can ping the device however and it connects fine.

<!-- gh-comment-id:370164327 --> @jwktje commented on GitHub (Mar 3, 2018): Ah right! So that's where my confusion came from. Thought is was a lib function. I'll rewrite all my dot notation calls to instance calls and see if that works! Good catch. Update: Rewrote all calls to reflect the Gist entirely and the sketch compiles and runs. But the problem still remains sadly. Going to a route in Chrome still gives ERR_CONNECTION_REFUSED after setting up via the portal without actually pressing the reset button on the device. I can ping the device however and it connects fine.
Author
Owner

@tablatronix commented on GitHub (Mar 3, 2018):

Hmm ill try to test this myself and see what i can come up with.

<!-- gh-comment-id:370171341 --> @tablatronix commented on GitHub (Mar 3, 2018): Hmm ill try to test this myself and see what i can come up with.
Author
Owner

@tablatronix commented on GitHub (Mar 4, 2018):

for some reason this doesnt work

server.reset(new my_WebServer(WiFi.localIP(), 80));
it is running the wrong constructor and thinking ip is int, so port gets set to xxx. of the ip instead of 80
My server is found on port 10 for example.

just remove it it should work

server.reset(new my_WebServer();

here my gist for esp32 esp8266

https://gist.github.com/tablatronix/e57dc3096ea311dd0e59aa512b8fe6e7

<!-- gh-comment-id:370237775 --> @tablatronix commented on GitHub (Mar 4, 2018): for some reason this doesnt work `server.reset(new my_WebServer(WiFi.localIP(), 80));` it is running the wrong constructor and thinking ip is int, so port gets set to `xxx`. of the ip instead of 80 My server is found on port 10 for example. just remove it it should work ` server.reset(new my_WebServer();` here my gist for esp32 esp8266 https://gist.github.com/tablatronix/e57dc3096ea311dd0e59aa512b8fe6e7
Author
Owner

@tablatronix commented on GitHub (Mar 4, 2018):

there is no wifiserver constructor for this

_server(addr, port)
so it takes the addr as port.

<!-- gh-comment-id:370238274 --> @tablatronix commented on GitHub (Mar 4, 2018): there is no wifiserver constructor for this `_server(addr, port)` so it takes the addr as port.
Author
Owner

@jwktje commented on GitHub (Mar 4, 2018):

Just tried exactly what you put in the gist this but still the problem remains. The server keeps giving ERR_CONNECTION_REFUSED just after configuring the wifi. And after a reset it does handle routes fine. Obviously this was tested with wifiManager.resetSettings() commented out as otherwise a manual reset would remove the credentials so it could never work.

Anything else I could test? I don't even mind paying a small bug bounty for this or something? Would be awesome to get this patched.

<!-- gh-comment-id:370264803 --> @jwktje commented on GitHub (Mar 4, 2018): Just tried exactly what you put in the gist this but still the problem remains. The server keeps giving ERR_CONNECTION_REFUSED just after configuring the wifi. And after a reset it does handle routes fine. Obviously this was tested with `wifiManager.resetSettings()` commented out as otherwise a manual reset would remove the credentials so it could never work. Anything else I could test? I don't even mind paying a small bug bounty for this or something? Would be awesome to get this patched.
Author
Owner

@tablatronix commented on GitHub (Mar 5, 2018):

You used the gist verbatim?

<!-- gh-comment-id:370279759 --> @tablatronix commented on GitHub (Mar 5, 2018): You used the gist verbatim?
Author
Owner

@tablatronix commented on GitHub (Mar 5, 2018):

Do me a favor, port scan your esp. what os are you on i can tell you how

<!-- gh-comment-id:370280001 --> @tablatronix commented on GitHub (Mar 5, 2018): Do me a favor, port scan your esp. what os are you on i can tell you how
Author
Owner

@jwktje commented on GitHub (Mar 5, 2018):

Just did a portscan on osx. This is the result:

Port Scan has started…

Port Scanning host: 192.168.2.23

Port Scan has completed…

I will try and start the server on a different port than 80 in the reset call. Just to see if it does spin up then.

Update:
Yep that works. Just changed the reset call to this:
server.reset(new WebServer(3000));
Then the portscan result is this:

Port Scan has started…

Port Scanning host: 192.168.2.23
Open TCP Port: 	3000   		hbci
Port Scan has completed…

Does this mean I'm "doomed" to run my server on any port except 80?

<!-- gh-comment-id:370478055 --> @jwktje commented on GitHub (Mar 5, 2018): Just did a portscan on osx. This is the result: ``` Port Scan has started… Port Scanning host: 192.168.2.23 Port Scan has completed… ``` I will try and start the server on a different port than 80 in the reset call. Just to see if it does spin up then. Update: Yep that works. Just changed the reset call to this: `server.reset(new WebServer(3000));` Then the portscan result is this: ``` Port Scan has started… Port Scanning host: 192.168.2.23 Open TCP Port: 3000 hbci Port Scan has completed… ``` Does this mean I'm "doomed" to run my server on any port except 80?
Author
Owner

@tablatronix commented on GitHub (Mar 5, 2018):

I am assuming you port scanned it after "HTTP Started"

Yeah that is very strange..
I may test some more.

<!-- gh-comment-id:370504009 --> @tablatronix commented on GitHub (Mar 5, 2018): I am assuming you port scanned it after "HTTP Started" Yeah that is very strange.. I may test some more.
Author
Owner

@jwktje commented on GitHub (Mar 5, 2018):

Yep, but that does only get logged during the capacitive portal phase like so
*WM: HTTP server started

There is no HTTP started logged afterwards when resetting my server.

When I port scan on the AP ip when connected to it's own AP network I get the following, as expected:

Port Scan has started…

Port Scanning host: 192.168.4.1

	 Open TCP Port: 	80     		http
<!-- gh-comment-id:370508497 --> @jwktje commented on GitHub (Mar 5, 2018): Yep, but that does only get logged during the capacitive portal phase like so `*WM: HTTP server started ` There is no HTTP started logged afterwards when resetting my server. When I port scan on the AP ip when connected to it's own AP network I get the following, as expected: ``` Port Scan has started… Port Scanning host: 192.168.4.1 Open TCP Port: 80 http ```
Author
Owner

@tablatronix commented on GitHub (Mar 5, 2018):

The gist says
"Serial.println("HTTP server started");"

Did you pull in the latest commits?

<!-- gh-comment-id:370514498 --> @tablatronix commented on GitHub (Mar 5, 2018): The gist says "Serial.println("HTTP server started");" Did you pull in the latest commits?
Author
Owner

@jwktje commented on GitHub (Mar 5, 2018):

Yes I tested that first and then went back to my own sketch for testing. But the relevant calls are identical in order. Just to be sure, I ran the gist again. This is the log

*WM: Sent config page 
*WM: -> captive.apple.com 
*WM: <- Request redirected to captive portal 
*WM: <- HTTP Root 
*WM: -> 192.168.4.1 
*WM: Scan is cached 
*WM: <- HTTP WiFi save  
*WM: Method: POST
*WM: Sent wifi save page 
*WM: Connecting to a new AP 
*WM: Connecting as wifi client... 
*WM: wifi station disconnect 
*WM: Connecting to new AP 
*WM: connectTimeout not set, ESP waitForConnectResult... 
*WM: Connection result: WL_CONNECTED
*WM: lastconxresult: WL_CONNECTED
*WM: Connect to new AP [SUCCESS] 
*WM: Got IP Address: 
*WM: 192.168.2.23 
*WM: disconnect configportal 
*WM: disconnect configportal - softAPdisconnect failed 
*WM: config portal exiting 
connected...yeey :)
HTTP server started
192.168.2.23
*WM: freeing allocated params! 
*WM: unloading 

Portscan results are as I explained before. I get port 80 when connected to the AP. And it finds nothing after connecting.

Anything else I can help to test? I did pull the latest commits yesterday from the Development branch

<!-- gh-comment-id:370533117 --> @jwktje commented on GitHub (Mar 5, 2018): Yes I tested that first and then went back to my own sketch for testing. But the relevant calls are identical in order. Just to be sure, I ran the gist again. This is the log ``` *WM: Sent config page *WM: -> captive.apple.com *WM: <- Request redirected to captive portal *WM: <- HTTP Root *WM: -> 192.168.4.1 *WM: Scan is cached *WM: <- HTTP WiFi save *WM: Method: POST *WM: Sent wifi save page *WM: Connecting to a new AP *WM: Connecting as wifi client... *WM: wifi station disconnect *WM: Connecting to new AP *WM: connectTimeout not set, ESP waitForConnectResult... *WM: Connection result: WL_CONNECTED *WM: lastconxresult: WL_CONNECTED *WM: Connect to new AP [SUCCESS] *WM: Got IP Address: *WM: 192.168.2.23 *WM: disconnect configportal *WM: disconnect configportal - softAPdisconnect failed *WM: config portal exiting connected...yeey :) HTTP server started 192.168.2.23 *WM: freeing allocated params! *WM: unloading ``` Portscan results are as I explained before. I get port 80 when connected to the AP. And it finds nothing after connecting. Anything else I can help to test? I did pull the latest commits yesterday from the Development branch
Author
Owner

@tablatronix commented on GitHub (Mar 5, 2018):

I will try to test again on my side, because it was working for me before, I do not have a working ap at the moment, so it might take a bit. For some reason esp32 doesn't see my hotspot like esp8266 does.

<!-- gh-comment-id:370537388 --> @tablatronix commented on GitHub (Mar 5, 2018): I will try to test again on my side, because it was working for me before, I do not have a working ap at the moment, so it might take a bit. For some reason esp32 doesn't see my hotspot like esp8266 does.
Author
Owner

@tablatronix commented on GitHub (Mar 5, 2018):

were you also running the core dnsserver?

<!-- gh-comment-id:370589056 --> @tablatronix commented on GitHub (Mar 5, 2018): were you also running the core dnsserver?
Author
Owner

@tablatronix commented on GitHub (Mar 6, 2018):

Still no reproduce, even on port 80.
works for me, on captive portal save, and autoconnect success.

I added a 1 second delay before server.reset, not sure if that increased stability or not.

this helps testing also

  server->on("/erase", []() {
    server->send(200, "text/plain", "erasing");
    WiFiManager wifiManager();
    wifiManager.erase();
    delay(1000);
    ESP.restart();
  });

personally I would destroy the wifimanager instance before starting the webserver, unless your code needs it to stick around, at least stopWebPortal()

<!-- gh-comment-id:370652253 --> @tablatronix commented on GitHub (Mar 6, 2018): Still no reproduce, even on port 80. works for me, on captive portal save, and autoconnect success. I added a 1 second delay before server.reset, not sure if that increased stability or not. this helps testing also ```cpp server->on("/erase", []() { server->send(200, "text/plain", "erasing"); WiFiManager wifiManager(); wifiManager.erase(); delay(1000); ESP.restart(); }); ``` personally I would destroy the wifimanager instance before starting the webserver, unless your code needs it to stick around, at least stopWebPortal()
Author
Owner

@jwktje commented on GitHub (Mar 6, 2018):

Nope I just checked and I was using bbx10/DNSServer_tng as the DNS server. This might be the problem? I will check again with the core one. I remember needing the bbx10 DNS server as tipped in an issue a while back. But maybe core is stable enough now for esp32.

Will report back soon! (tonight probably)

<!-- gh-comment-id:370694378 --> @jwktje commented on GitHub (Mar 6, 2018): Nope I just checked and I was using bbx10/DNSServer_tng as the DNS server. This might be the problem? I will check again with the core one. I remember needing the bbx10 DNS server as tipped in an issue a while back. But maybe core is stable enough now for esp32. Will report back soon! (tonight probably)
Author
Owner

@tablatronix commented on GitHub (Mar 6, 2018):

I doubt it, dnsserver was just updated in core yesterday. Just making sure I am on the same page.

<!-- gh-comment-id:370772181 --> @tablatronix commented on GitHub (Mar 6, 2018): I doubt it, dnsserver was just updated in core yesterday. Just making sure I am on the same page.
Author
Owner

@jwktje commented on GitHub (Mar 6, 2018):

Could this just be a flaw in the ESP32 chip with this setup though? I just tested again with the latest commits for WiFiManager and nothing but the core libs and the bbx10 webserver. Both my code and your Gist, but no luck.

<!-- gh-comment-id:370873032 --> @jwktje commented on GitHub (Mar 6, 2018): Could this just be a flaw in the ESP32 chip with this setup though? I just tested again with the latest commits for WiFiManager and nothing but the core libs and the bbx10 webserver. Both my code and your Gist, but no luck.
Author
Owner

@jwktje commented on GitHub (Mar 6, 2018):

Wow wow wow wait. Just tested without explicitly including the WebServer.h and now it looks like it's working. I only commented out like so #include <WebServer.h>. Maybe the ESP32 arduino environment now has a more stable WebServer?

Update:
And now it randomly doesn't anymore. :( No rhyme or reason

Another update:
It now seems to work shakily but it is an improvement. After resetting and repeating the setup process via WifiManager about 20 times, I get ~75% success rate on finding port 80 after a portscan.

I don't know how to further improve now as this makes it even more fuzzy for me to pinpoint the reason for this.

Third update:
Obviously by uncommenting the line for WebServer.h my sketch is probably including ESP8266WebServer as that's defined in WiFiManager right? Maybe this is causing the difference in results I'm seeing?

<!-- gh-comment-id:370873909 --> @jwktje commented on GitHub (Mar 6, 2018): Wow wow wow wait. Just tested without explicitly including the WebServer.h and now it looks like it's working. I only commented out like so `#include <WebServer.h>`. Maybe the ESP32 arduino environment now has a more stable WebServer? Update: And now it randomly doesn't anymore. :( No rhyme or reason Another update: It now seems to work shakily but it is an improvement. After resetting and repeating the setup process via WifiManager about 20 times, I get ~75% success rate on finding port 80 after a portscan. I don't know how to further improve now as this makes it even more fuzzy for me to pinpoint the reason for this. Third update: Obviously by uncommenting the line for WebServer.h my sketch is probably including ESP8266WebServer as that's defined in WiFiManager right? Maybe this is causing the difference in results I'm seeing?
Author
Owner

@tablatronix commented on GitHub (Mar 6, 2018):

That would not matter wm includes the webserver, there is no webserver in esp32 at all.

How exactly are you testing this ? Wipe settings, connecting to ap, saveing, then trying to connect to your webserver and it fails ?

Did you try enabling debug flag -DDEBUG_ESP_HTTP_SERVER and see what happens?

<!-- gh-comment-id:370883223 --> @tablatronix commented on GitHub (Mar 6, 2018): That would not matter wm includes the webserver, there is no webserver in esp32 at all. How exactly are you testing this ? Wipe settings, connecting to ap, saveing, then trying to connect to your webserver and it fails ? Did you try enabling debug flag -DDEBUG_ESP_HTTP_SERVER and see what happens?
Author
Owner

@jwktje commented on GitHub (Mar 6, 2018):

Yep exactly that is how I've been testing for the last hour. I will try the debug flag now and continue testing.
Update:
Using the Arduino IDE I can only set "Verbose" debugging at max. Will test some more though

<!-- gh-comment-id:370883516 --> @jwktje commented on GitHub (Mar 6, 2018): Yep exactly that is how I've been testing for the last hour. I will try the debug flag now and continue testing. Update: Using the Arduino IDE I can only set "Verbose" debugging at max. Will test some more though
Author
Owner

@jwktje commented on GitHub (Mar 6, 2018):

I'm now getting the logs below with verbose debugging. It shows the AP_STOP event after I'm trying to reset my WebServer. Maybe this could be causing trouble?

[D][WiFiGeneric.cpp:293] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:293] _eventCallback(): Event: 7 - STA_GOT_IP
*WM: Connection result: WL_CONNECTED
*WM: lastconxresult: WL_CONNECTED
*WM: Connect to new AP [SUCCESS] 
*WM: Got IP Address: 
*WM: 192.168.2.23 
*WM: disconnect configportal 
*WM: disconnect configportal - softAPdisconnect failed 
*WM: config portal exiting 
Server Started!
*WM: freeing allocated params! 
*WM: unloading 
[D][WiFiGeneric.cpp:293] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:293] _eventCallback(): Event: 14 - AP_STOP
<!-- gh-comment-id:370886236 --> @jwktje commented on GitHub (Mar 6, 2018): I'm now getting the logs below with verbose debugging. It shows the AP_STOP event after I'm trying to reset my WebServer. Maybe this could be causing trouble? ``` [D][WiFiGeneric.cpp:293] _eventCallback(): Event: 4 - STA_CONNECTED [D][WiFiGeneric.cpp:293] _eventCallback(): Event: 7 - STA_GOT_IP *WM: Connection result: WL_CONNECTED *WM: lastconxresult: WL_CONNECTED *WM: Connect to new AP [SUCCESS] *WM: Got IP Address: *WM: 192.168.2.23 *WM: disconnect configportal *WM: disconnect configportal - softAPdisconnect failed *WM: config portal exiting Server Started! *WM: freeing allocated params! *WM: unloading [D][WiFiGeneric.cpp:293] _eventCallback(): Event: 14 - AP_STOP [D][WiFiGeneric.cpp:293] _eventCallback(): Event: 14 - AP_STOP ```
Author
Owner

@tablatronix commented on GitHub (Mar 6, 2018):

did you ever add that delay I mentioned?

  delay(1000);
  server.reset(new my_WebServer(80));
<!-- gh-comment-id:370886975 --> @tablatronix commented on GitHub (Mar 6, 2018): did you ever add that delay I mentioned? ``` delay(1000); server.reset(new my_WebServer(80)); ```
Author
Owner

@jwktje commented on GitHub (Mar 6, 2018):

Yep that's in my sketch. It is the only relevant change I made which is now causing it to work a majority of the times. As I now realize that uncommenting the WebServer library makes no difference.

Should I just increase it to a crazy amount of seconds and check my mileage?

<!-- gh-comment-id:370889973 --> @jwktje commented on GitHub (Mar 6, 2018): Yep that's in my sketch. It is the only relevant change I made which is now causing it to work a majority of the times. As I now realize that uncommenting the WebServer library makes no difference. Should I just increase it to a crazy amount of seconds and check my mileage?
Author
Owner

@tablatronix commented on GitHub (Mar 7, 2018):

I just started getting crashes on my esp32 with this code for some reason.

I had to remove this

  // server->on("/inline", []() {
  //   server->send(200, "text/plain", "this works as well");
  // });

whats more interesting is this

Exception Cause: Not found

0x40078000: ?? ??:0
0x40078000: ?? ??:0
0x40078a28: ?? ??:0
0x4000c46c: ?? ??:0
0x4000c477: ?? ??:0
0x400827d4: start_cpu0_default at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./cpu_start.c:328
0x400829c0: call_start_cpu0 at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./cpu_start.c:203
0x4007887a: ?? ??:0
0x400788e1: ?? ??:0
0x40078a21: ?? ??:0
0x40078b4a: ?? ??:0
0x40007c31: ?? ??:0
0x4000073d: ?? ??:0
<!-- gh-comment-id:371224523 --> @tablatronix commented on GitHub (Mar 7, 2018): I just started getting crashes on my esp32 with this code for some reason. I had to remove this ``` // server->on("/inline", []() { // server->send(200, "text/plain", "this works as well"); // }); ```` whats more interesting is this ``` Exception Cause: Not found 0x40078000: ?? ??:0 0x40078000: ?? ??:0 0x40078a28: ?? ??:0 0x4000c46c: ?? ??:0 0x4000c477: ?? ??:0 0x400827d4: start_cpu0_default at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./cpu_start.c:328 0x400829c0: call_start_cpu0 at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./cpu_start.c:203 0x4007887a: ?? ??:0 0x400788e1: ?? ??:0 0x40078a21: ?? ??:0 0x40078b4a: ?? ??:0 0x40007c31: ?? ??:0 0x4000073d: ?? ??:0 ```
Author
Owner

@jwktje commented on GitHub (Mar 7, 2018):

Hmm. Well, I am a webdeveloper first, and Arduino enthusiast second. So maybe I'm misunderstanding.

But does this indicate just instability in the Arduino Core from espressif? I mean, random Exceptions/crashes when using function as they are intended. Isn't that just a result of core bugs?

<!-- gh-comment-id:371237115 --> @jwktje commented on GitHub (Mar 7, 2018): Hmm. Well, I am a webdeveloper first, and Arduino enthusiast second. So maybe I'm misunderstanding. But does this indicate just instability in the Arduino Core from espressif? I mean, random Exceptions/crashes when using function as they are intended. Isn't that just a result of core bugs?
Author
Owner

@tablatronix commented on GitHub (Mar 7, 2018):

it goes away when changing various pieces of code, so its probably unrelated, maybe a compiler bug

<!-- gh-comment-id:371244482 --> @tablatronix commented on GitHub (Mar 7, 2018): it goes away when changing various pieces of code, so its probably unrelated, maybe a compiler bug
Author
Owner

@tablatronix commented on GitHub (Mar 14, 2018):

I posted this to esp32 lib, still no response

<!-- gh-comment-id:373097278 --> @tablatronix commented on GitHub (Mar 14, 2018): I posted this to esp32 lib, still no response
Author
Owner

@andrewjaykeller commented on GitHub (Apr 7, 2018):

is my issue of not being able to run wifiManager at the same time as a WebServer on port 80 related to this? I tried doing a server.stop() but that does not seem to help.

<!-- gh-comment-id:379479647 --> @andrewjaykeller commented on GitHub (Apr 7, 2018): is my issue of not being able to run wifiManager at the same time as a WebServer on port 80 related to this? I tried doing a server.stop() but that does not seem to help.
Author
Owner

@tablatronix commented on GitHub (Apr 7, 2018):

no

<!-- gh-comment-id:379481007 --> @tablatronix commented on GitHub (Apr 7, 2018): no
Author
Owner

@andrewjaykeller commented on GitHub (Apr 7, 2018):

Should I open another issue for that?

<!-- gh-comment-id:379481764 --> @andrewjaykeller commented on GitHub (Apr 7, 2018): Should I open another issue for that?
Author
Owner

@tablatronix commented on GitHub (Apr 7, 2018):

There are already issues discussing the exact same thing, you cant run 2 webservers ...

<!-- gh-comment-id:379493635 --> @tablatronix commented on GitHub (Apr 7, 2018): There are already issues discussing the exact same thing, you cant run 2 webservers ...
Author
Owner

@tablatronix commented on GitHub (Apr 7, 2018):

Maybe make a simple sketch and paste it?

<!-- gh-comment-id:379494677 --> @tablatronix commented on GitHub (Apr 7, 2018): Maybe make a simple sketch and paste it?
Author
Owner

@tablatronix commented on GitHub (Apr 7, 2018):

Did you test my gist?

<!-- gh-comment-id:379496139 --> @tablatronix commented on GitHub (Apr 7, 2018): Did you test my gist?
Author
Owner

@andrewjaykeller commented on GitHub (Apr 8, 2018):

@tablatronix hi!

I just ripped out all the unneeded code to make a simple example!

https://github.com/PushTheWorld/OpenBCI_Air_Shield_Library/blob/esp32/examples/ESP32WiFiManager/EPS32WiFiManager.ino

You can see see in line 243 where there is a lambda function call on a server route to start the wifi manager (a flag is set true, 200 response sent to client) then later in loop the wifi manager is started.

<!-- gh-comment-id:379563757 --> @andrewjaykeller commented on GitHub (Apr 8, 2018): @tablatronix hi! I just ripped out all the unneeded code to make a simple example! https://github.com/PushTheWorld/OpenBCI_Air_Shield_Library/blob/esp32/examples/ESP32WiFiManager/EPS32WiFiManager.ino You can see see in [line 243](https://github.com/PushTheWorld/OpenBCI_Air_Shield_Library/blob/a1f97f92324a5267e0e7b0372bb5b20ec4a12800/examples/ESP32WiFiManager/EPS32WiFiManager.ino#L243) where there is a lambda function call on a server route to start the wifi manager (a flag is set true, 200 response sent to client) then later [in loop](https://github.com/PushTheWorld/OpenBCI_Air_Shield_Library/blob/a1f97f92324a5267e0e7b0372bb5b20ec4a12800/examples/ESP32WiFiManager/EPS32WiFiManager.ino#L361) the wifi manager is started.
Author
Owner

@tablatronix commented on GitHub (Apr 8, 2018):

Hmm similar error here #585 but esp8266

<!-- gh-comment-id:379566825 --> @tablatronix commented on GitHub (Apr 8, 2018): Hmm similar error here #585 but esp8266
Author
Owner

@anwarbashir commented on GitHub (Jun 15, 2018):

Hi, I am using Platform.IO with development version of WifiManager (tzapu) and WebServer (bbx10). I am exclusively using ESP32. I am able to obtain a WiFi connection, but after accessing via AP the WiFi on my phone does not revert and I have to reset it manually. This is okay but a bit cumbersome. I think on the ESP8266 it reverts automatically. I think that the reason for this behaviour is down to a {ERROR} disconnect configportal - softAPdisconnect FAILED (But I may be wrong)? In any case can someone advise me, is it possible for the phone to reconnect to WiFi afterwards automatically and if so what can I do to enable this functionality. The console log is provided below:

--- Miniterm on COM5 9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
b����␂␄ ␃�␗␙�$�d'�␀3v�E (20370) wifi: esp_wifi_disconnect 847 wifi not start
*WM: Disabling STA
*WM: Enabling AP
*WM: StartAP with SSID: thing2car
*WM: AP has anonymous access!
*WM: AP IP address: 192.168.4.1
*WM: Starting Web Portal
*WM: HTTP server started
*WM: WiFi Scan done
*WM: Config Portal Running, blocking, waiting for clients...
*WM: NUM CLIENTS: 1
*WM: <- HTTP Wifi
*WM: Scan is cached
*WM: 4 networks found
*WM: DUP AP: Virgin Media
*WM: AP: -45 VM575052-2G
*WM: AP: -45 Virgin Media
*WM: AP: -93 VM2135198
*WM: <- HTTP WiFi save
*WM: process connect
*WM: Connecting as wifi client...
*WM: Connecting to new AP: VM575052-2G
*WM: connectTimeout not set, ESP waitForConnectResult...
*WM: Connection result: WL_CONNECTED
*WM: Connect to new AP [SUCCESS]
*WM: Got IP Address:
*WM: 192.168.0.11
*WM: disconnect configportal
*WM: [ERROR] disconnect configportal - softAPdisconnect FAILED
*WM: config portal exiting
connected...yeey
Attempting MQTT connection...connected

<!-- gh-comment-id:397634071 --> @anwarbashir commented on GitHub (Jun 15, 2018): Hi, I am using Platform.IO with development version of WifiManager (tzapu) and WebServer (bbx10). I am exclusively using ESP32. I am able to obtain a WiFi connection, but after accessing via AP the WiFi on my phone does not revert and I have to reset it manually. This is okay but a bit cumbersome. I think on the ESP8266 it reverts automatically. I think that the reason for this behaviour is down to a {ERROR} disconnect configportal - softAPdisconnect FAILED (But I may be wrong)? In any case can someone advise me, is it possible for the phone to reconnect to WiFi afterwards automatically and if so what can I do to enable this functionality. The console log is provided below: --- Miniterm on COM5 9600,8,N,1 --- --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- b����␂␄ ␃�␗␙�$�d'�␀3v�E (20370) wifi: esp_wifi_disconnect 847 wifi not start *WM: Disabling STA *WM: Enabling AP *WM: StartAP with SSID: thing2car *WM: AP has anonymous access! *WM: AP IP address: 192.168.4.1 *WM: Starting Web Portal *WM: HTTP server started *WM: WiFi Scan done *WM: Config Portal Running, blocking, waiting for clients... *WM: NUM CLIENTS: 1 *WM: <- HTTP Wifi *WM: Scan is cached *WM: 4 networks found *WM: DUP AP: Virgin Media *WM: AP: -45 VM575052-2G *WM: AP: -45 Virgin Media *WM: AP: -93 VM2135198 *WM: <- HTTP WiFi save *WM: process connect *WM: Connecting as wifi client... *WM: Connecting to new AP: VM575052-2G *WM: connectTimeout not set, ESP waitForConnectResult... *WM: Connection result: WL_CONNECTED *WM: Connect to new AP [SUCCESS] *WM: Got IP Address: *WM: 192.168.0.11 *WM: disconnect configportal *WM: [ERROR] disconnect configportal - softAPdisconnect FAILED *WM: config portal exiting connected...yeey Attempting MQTT connection...connected
Author
Owner

@tablatronix commented on GitHub (Jun 15, 2018):

When was the last time you pulled in esp32 lib ?

<!-- gh-comment-id:397721737 --> @tablatronix commented on GitHub (Jun 15, 2018): When was the last time you pulled in esp32 lib ?
Author
Owner

@anwarbashir commented on GitHub (Jun 16, 2018):

@tablatronix - it was some time ago, seems from your comment that I need the latest, so I will look at how to download and install the latest. If you could advise a link that would be useful - thanks.

<!-- gh-comment-id:397802186 --> @anwarbashir commented on GitHub (Jun 16, 2018): @tablatronix - it was some time ago, seems from your comment that I need the latest, so I will look at how to download and install the latest. If you could advise a link that would be useful - thanks.
Author
Owner

@tablatronix commented on GitHub (Jun 16, 2018):

I have no idea what environment you are using but you get it from github.

<!-- gh-comment-id:397815747 --> @tablatronix commented on GitHub (Jun 16, 2018): I have no idea what environment you are using but you get it from github.
Author
Owner

@anwarbashir commented on GitHub (Jun 16, 2018):

@tablatronix I am using Platform.IO. Thanks to your comment I checked the Platform Version shown on Platforms in IDE it was Espressif 32 version 0.12.0 and showing that an update was available to 1.0.2. I upgraded and, subject to further testing, this seems to have worked. Many, many thanks :)

<!-- gh-comment-id:397830741 --> @anwarbashir commented on GitHub (Jun 16, 2018): @tablatronix I am using Platform.IO. Thanks to your comment I checked the Platform Version shown on Platforms in IDE it was Espressif 32 version 0.12.0 and showing that an update was available to 1.0.2. I upgraded and, subject to further testing, this seems to have worked. Many, many thanks :)
Author
Owner

@UroojAlam commented on GitHub (Jun 16, 2020):

For me, changing the web server port to 81 and 8080 without using wifiManager.resetSetting(); worked.

<!-- gh-comment-id:645058817 --> @UroojAlam commented on GitHub (Jun 16, 2020): For me, changing the web server port to 81 and 8080 without using `wifiManager.resetSetting();` worked.
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#457
No description provided.