[GH-ISSUE #379] Non blocking AP mode #319

Closed
opened 2026-02-28 01:24:43 +03:00 by kerem · 80 comments
Owner

Originally created by @git-tiger on GitHub (Jun 28, 2017).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/379

I have a project that requires the ESP8266 to startup in access point mode, but the remaining code is blocked till the access point is configured.
Is there any way to continue with the code, and still have access point available in the background?

Originally created by @git-tiger on GitHub (Jun 28, 2017). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/379 I have a project that requires the ESP8266 to startup in access point mode, but the remaining code is blocked till the access point is configured. Is there any way to continue with the code, and still have access point available in the background?
kerem 2026-02-28 01:24:43 +03:00
Author
Owner

@synfinatic commented on GitHub (Jun 30, 2017):

I've got the same requirement and from what I can tell, there isn't a way to do this in the current code today.

<!-- gh-comment-id:312369943 --> @synfinatic commented on GitHub (Jun 30, 2017): I've got the same requirement and from what I can tell, there isn't a way to do this in the current code today.
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

Hi Guys,

Is this feature added? am really in bad need for this.

<!-- gh-comment-id:376607028 --> @ANASOMARY commented on GitHub (Mar 27, 2018): Hi Guys, Is this feature added? am really in bad need for this.
Author
Owner

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

development branch

    //if this is set, portal will be blocking and wait until save or exit,  
    // is false user must manually `process()` to handle config portal
    void          setConfigPortalBlocking(boolean shouldBlock);

example
https://github.com/tzapu/WiFiManager/issues/379#issuecomment-405046137

#500

<!-- gh-comment-id:376609786 --> @tablatronix commented on GitHub (Mar 27, 2018): development branch ```C++ //if this is set, portal will be blocking and wait until save or exit, // is false user must manually `process()` to handle config portal void setConfigPortalBlocking(boolean shouldBlock); ``` example https://github.com/tzapu/WiFiManager/issues/379#issuecomment-405046137 #500
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

Hi,
Really appreciate your reply.
I did not get the process() part , but if I wanted the code to continue to the loop even after going into AP mode, then should I set setConfigPortalBlocking(false); ?? and in this case I will still get the portal but at the same time the code will continue to the loop function. right?

wifiManager.setAPStaticIPConfig(ip, gateway, subnet);
wifiManager.setAPCallback(configModeCallback);
setConfigPortalBlocking(false);
wifiManager.setSTAStaticIPConfig(lip, lgateway, lsubnet);
if (mdns.begin("STR_Master8004", WiFi.softAPIP()));
if (!wifiManager.autoConnect(const_cast<char*>(mySsid.c_str()), const_cast<char*>(myPassword.c_str()))) {
Serial.println("failed to connect and hit timeout");
connectionFailed = 1;
ESP.reset();
delay(1000);
}

<!-- gh-comment-id:376611195 --> @ANASOMARY commented on GitHub (Mar 27, 2018): Hi, Really appreciate your reply. I did not get the process() part , but if I wanted the code to continue to the loop even after going into AP mode, then should I set setConfigPortalBlocking(false); ?? and in this case I will still get the portal but at the same time the code will continue to the loop function. right? wifiManager.setAPStaticIPConfig(ip, gateway, subnet); wifiManager.setAPCallback(configModeCallback); **_setConfigPortalBlocking(false);_** wifiManager.setSTAStaticIPConfig(lip, lgateway, lsubnet); if (mdns.begin("STR_Master8004", WiFi.softAPIP())); if (!wifiManager.autoConnect(const_cast<char*>(mySsid.c_str()), const_cast<char*>(myPassword.c_str()))) { Serial.println("failed to connect and hit timeout"); connectionFailed = 1; ESP.reset(); delay(1000); }
Author
Owner

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

yes and process() in your loop

<!-- gh-comment-id:376613105 --> @tablatronix commented on GitHub (Mar 27, 2018): yes and `process()` in your loop
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

void loop()
{
process();
HandleSwitch();
server.handleClient();
delay(10);
}

Thats it??? Oh god thanks Shawn, you really saved my @. 💯

<!-- gh-comment-id:376614182 --> @ANASOMARY commented on GitHub (Mar 27, 2018): void loop() { _**process();**_ HandleSwitch(); server.handleClient(); delay(10); } Thats it??? Oh god thanks Shawn, you really saved my @$$. 💯
Author
Owner

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

Yeah I mean its development, and hardly tested...

<!-- gh-comment-id:376614510 --> @tablatronix commented on GitHub (Mar 27, 2018): Yeah I mean its development, and hardly tested...
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

Oh snap
image

<!-- gh-comment-id:376614729 --> @ANASOMARY commented on GitHub (Mar 27, 2018): Oh snap ![image](https://user-images.githubusercontent.com/16349989/37984902-89649a4e-3208-11e8-87a9-9a26e7ea9516.png)
Author
Owner

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

https://github.com/tzapu/WiFiManager/issues/500

<!-- gh-comment-id:376615636 --> @tablatronix commented on GitHub (Mar 27, 2018): https://github.com/tzapu/WiFiManager/issues/500
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

Thanks Shawn,

does it support generic esp8266? am using a sonoff, and am getting the following when I compile:
image

<!-- gh-comment-id:376618101 --> @ANASOMARY commented on GitHub (Mar 27, 2018): Thanks Shawn, does it support generic esp8266? am using a sonoff, and am getting the following when I compile: ![image](https://user-images.githubusercontent.com/16349989/37985498-f388b2ce-3209-11e8-8b2d-5fb31fb9da63.png)
Author
Owner

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

It should, what board?

<!-- gh-comment-id:376619120 --> @tablatronix commented on GitHub (Mar 27, 2018): It should, what board?
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

Sonoff Basic

<!-- gh-comment-id:376621697 --> @ANASOMARY commented on GitHub (Mar 27, 2018): Sonoff Basic
Author
Owner

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

I mean what esp board?

<!-- gh-comment-id:376626336 --> @tablatronix commented on GitHub (Mar 27, 2018): I mean what esp board?
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

esp8266

<!-- gh-comment-id:376626567 --> @ANASOMARY commented on GitHub (Mar 27, 2018): esp8266
Author
Owner

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

esp8266 which one?
esp01?
esp12e?

<!-- gh-comment-id:376637159 --> @tablatronix commented on GitHub (Mar 27, 2018): esp8266 which one? esp01? esp12e?
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

ESP8266 V4.1

<!-- gh-comment-id:376651985 --> @ANASOMARY commented on GitHub (Mar 27, 2018): ESP8266 V4.1
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

Hi Shawn,
my mistake, instead of Process() I should have put wifiManager.process(); same for setConfigPortalBlocking
It is compiling with no errors now.
Thanks again.

<!-- gh-comment-id:376654052 --> @ANASOMARY commented on GitHub (Mar 27, 2018): Hi Shawn, my mistake, instead of Process() I should have put wifiManager.process(); same for setConfigPortalBlocking It is compiling with no errors now. Thanks again.
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

Am Sorry Shawn, But I was using the wrong library, am still getting the same compilation error for generic esp8266
image

<!-- gh-comment-id:376657092 --> @ANASOMARY commented on GitHub (Mar 27, 2018): Am Sorry Shawn, But I was using the wrong library, am still getting the same compilation error for generic esp8266 ![image](https://user-images.githubusercontent.com/16349989/37992054-c82c4c78-321b-11e8-817b-02a9bb76ce71.png)
Author
Owner

@ANASOMARY commented on GitHub (Mar 27, 2018):

This is strange... I tried compiling for a different board, and am getting the same error!
image

Update: it is not compiling for any board now. Please help!

<!-- gh-comment-id:376657714 --> @ANASOMARY commented on GitHub (Mar 27, 2018): This is strange... I tried compiling for a different board, and am getting the same error! ![image](https://user-images.githubusercontent.com/16349989/37992201-1258bff2-321c-11e8-9173-7563bd6ff0bb.png) Update: it is not compiling for any board now. Please help!
Author
Owner

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

You are gonna have to turn on verbose compilation warnings or whatever adruino has to show some actual info

<!-- gh-comment-id:376688696 --> @tablatronix commented on GitHub (Mar 27, 2018): You are gonna have to turn on verbose compilation warnings or whatever adruino has to show some actual info
Author
Owner

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

https://github.com/tzapu/WiFiManager/issues/524

<!-- gh-comment-id:376689343 --> @tablatronix commented on GitHub (Mar 27, 2018): https://github.com/tzapu/WiFiManager/issues/524
Author
Owner

@hassasian commented on GitHub (Apr 19, 2018):

@ANASOMARY you should update your board software from board manager. You should use 2.4.1 or newer one.

<!-- gh-comment-id:382707740 --> @hassasian commented on GitHub (Apr 19, 2018): @ANASOMARY you should update your board software from board manager. You should use 2.4.1 or newer one.
Author
Owner

@hassasian commented on GitHub (Apr 19, 2018):

@tablatronix thx for ur help. But I have one more question. Our esp connected to an router. After that I close the router. Then as suppose our esp come back to AP mode. When I connected ap of esp, it cannot handle http requests. Sorry for bad eng.

<!-- gh-comment-id:382766762 --> @hassasian commented on GitHub (Apr 19, 2018): @tablatronix thx for ur help. But I have one more question. Our esp connected to an router. After that I close the router. Then as suppose our esp come back to AP mode. When I connected ap of esp, it cannot handle http requests. Sorry for bad eng.
Author
Owner

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

not sure i understand

<!-- gh-comment-id:382767857 --> @tablatronix commented on GitHub (Apr 19, 2018): not sure i understand
Author
Owner

@hassasian commented on GitHub (Apr 19, 2018):

Give me one more shot to explain it :) I have a esp8266 module. I'm using wifimanager development branch for nonblocking ap mode. its working great. Congrats. My problem is that ; when esp cannot access the router which esp connected before it come back to access mode as expected. And I connect the AutoConnectAP with my computer to configure my esp for another router. But esp cannot answer my http request.

<!-- gh-comment-id:382769979 --> @hassasian commented on GitHub (Apr 19, 2018): Give me one more shot to explain it :) I have a esp8266 module. I'm using wifimanager development branch for nonblocking ap mode. its working great. Congrats. My problem is that ; when esp cannot access the router which esp connected before it come back to access mode as expected. And I connect the AutoConnectAP with my computer to configure my esp for another router. But esp cannot answer my http request.
Author
Owner

@hassasian commented on GitHub (Apr 19, 2018):

in addition if you reset your router which esp connected. Esp disconnected from router and enabling its ap. After your router started. Esp connect the router succesfully but esp dont close its ap. Briefly if you restart your router, your esp will enable its ap mode. After your router come back esp will connect it but dont close its ap.

<!-- gh-comment-id:382773200 --> @hassasian commented on GitHub (Apr 19, 2018): in addition if you reset your router which esp connected. Esp disconnected from router and enabling its ap. After your router started. Esp connect the router succesfully but esp dont close its ap. Briefly if you restart your router, your esp will enable its ap mode. After your router come back esp will connect it but dont close its ap.
Author
Owner

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

Yeah the ap stays running, the portal only runs if you reboot.
The ap is not supposed to stay running, thats probably a bug

<!-- gh-comment-id:382776009 --> @tablatronix commented on GitHub (Apr 19, 2018): Yeah the ap stays running, the portal only runs if you reboot. The ap is not supposed to stay running, thats probably a bug
Author
Owner

@hassasian commented on GitHub (Apr 19, 2018):

Hmm so that means if our router stop working we need to restart our esp physically? Or can we understand that esp disconnected from router. For restarting programmatically.

<!-- gh-comment-id:382776875 --> @hassasian commented on GitHub (Apr 19, 2018): Hmm so that means if our router stop working we need to restart our esp physically? Or can we understand that esp disconnected from router. For restarting programmatically.
Author
Owner

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

The esp should reconnect by itself , that is part of esp library, not wm

<!-- gh-comment-id:382790091 --> @tablatronix commented on GitHub (Apr 19, 2018): The esp should reconnect by itself , that is part of esp library, not wm
Author
Owner

@hassasian commented on GitHub (Apr 19, 2018):

I got it I mean do we have a callback function for understanding when it connects a router?

<!-- gh-comment-id:382790737 --> @hassasian commented on GitHub (Apr 19, 2018): I got it I mean do we have a callback function for understanding when it connects a router?
Author
Owner

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

No, but you can use the esp events

<!-- gh-comment-id:382790874 --> @tablatronix commented on GitHub (Apr 19, 2018): No, but you can use the esp events
Author
Owner

@imsyf commented on GitHub (May 12, 2018):

@tablatronix

The esp should reconnect by itself , that is part of esp library, not wm

How do we break from WiFiManager::startConfigPortal loop when the board successfully reconnected to Wi-Fi by itself due to ESP8266 library's funtionality as you implied?

Because in my experience, I'm able to identify when it actually happens thanks to WiFiEvent callback, but the process wouldn't immediately escape to loop funtion, not until WiFiManager timeout

<!-- gh-comment-id:388558525 --> @imsyf commented on GitHub (May 12, 2018): @tablatronix > The esp should reconnect by itself , that is part of esp library, not wm How do we break from `WiFiManager::startConfigPortal` loop when the board successfully reconnected to Wi-Fi by itself due to ESP8266 library's funtionality as you implied? Because in my experience, I'm able to identify when it actually happens thanks to WiFiEvent callback, but the process wouldn't immediately escape to `loop` funtion, not until WiFiManager timeout
Author
Owner

@tablatronix commented on GitHub (May 12, 2018):

I do not think this is handled automatically, since when in configportal usually STA mode is disabled so AP mode works properly.

It is not wise, to do so ( leave sta mode on ) , and has been updated in hotfixes branch and development as such. If STA is failing it makes AP mode very unstable.

But if you wanted to, in development branch , (if you hardcode channel for stability and leave sta on), you can call stopConfigPortal at any time.

<!-- gh-comment-id:388563377 --> @tablatronix commented on GitHub (May 12, 2018): I do not think this is handled automatically, since when in configportal usually STA mode is disabled so AP mode works properly. It is not wise, to do so ( leave sta mode on ) , and has been updated in hotfixes branch and development as such. If STA is failing it makes AP mode very unstable. But if you wanted to, in development branch , (if you hardcode channel for stability and leave sta on), you can call `stopConfigPortal` at any time.
Author
Owner

@Kirk-1 commented on GitHub (Jun 15, 2018):

Hi @tablatronix, Thanks for all your work on this.
I had AutoConnect working in non-blocking mode beautifully for a while. Now I am having an issue with:
W (84) wifi: wifi nvs_open fail ret=4353
E (84) wifi: wifi_init 1410 ret=4353

So now it seems it wont save the ssid and password once entered in the portal. I am wondering if you could shed any light on this. Perhaps nvs_init() needs to be called somewhere..?

Any help greatly appreciated!

Cheers,

Kirkland

<!-- gh-comment-id:397529799 --> @Kirk-1 commented on GitHub (Jun 15, 2018): Hi @tablatronix, Thanks for all your work on this. I had AutoConnect working in non-blocking mode beautifully for a while. Now I am having an issue with: W (84) wifi: wifi nvs_open fail ret=4353 E (84) wifi: wifi_init 1410 ret=4353 So now it seems it wont save the ssid and password once entered in the portal. I am wondering if you could shed any light on this. Perhaps nvs_init() needs to be called somewhere..? Any help greatly appreciated! Cheers, Kirkland
Author
Owner

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

Is this an esp32 or eps8266?

<!-- gh-comment-id:397722010 --> @tablatronix commented on GitHub (Jun 15, 2018): Is this an esp32 or eps8266?
Author
Owner

@Kirk-1 commented on GitHub (Jun 15, 2018):

ESP32 Wrover

<!-- gh-comment-id:397749315 --> @Kirk-1 commented on GitHub (Jun 15, 2018): ESP32 Wrover
Author
Owner

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

Try erasing nvs, there was a bug in esp32 lib a while ago.
You can find instructions in esp32 issues.

<!-- gh-comment-id:397765270 --> @tablatronix commented on GitHub (Jun 15, 2018): Try erasing nvs, there was a bug in esp32 lib a while ago. You can find instructions in esp32 issues.
Author
Owner

@Kirk-1 commented on GitHub (Jun 15, 2018):

Tried using pytool to erase. Tried using nvs_erase in sketch. Tried nvs_init at start of setup. Tried updating esp libraries. Tried the specific Webserver library recommended.
I use wifimanager.process() until I have a connection, then I swap over to serving a web page from within the sketch. So I have an instance of WiFi client, mdns and webserver in the sketch also. Perhaps this is the source of the problem. It was working fine but now this nvs issue. I will keep hunting... Thankyou. Cheers, Kirk

<!-- gh-comment-id:397767032 --> @Kirk-1 commented on GitHub (Jun 15, 2018): Tried using pytool to erase. Tried using nvs_erase in sketch. Tried nvs_init at start of setup. Tried updating esp libraries. Tried the specific Webserver library recommended. I use wifimanager.process() until I have a connection, then I swap over to serving a web page from within the sketch. So I have an instance of WiFi client, mdns and webserver in the sketch also. Perhaps this is the source of the problem. It was working fine but now this nvs issue. I will keep hunting... Thankyou. Cheers, Kirk
Author
Owner

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

You can try enabling debug compile flags.

<!-- gh-comment-id:397779959 --> @tablatronix commented on GitHub (Jun 16, 2018): You can try enabling debug compile flags.
Author
Owner

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

You might be calling something before wifi_init gets called.
Are you doing a printdiag() or anything ?

<!-- gh-comment-id:397780073 --> @tablatronix commented on GitHub (Jun 16, 2018): You might be calling something before wifi_init gets called. Are you doing a printdiag() or anything ?
Author
Owner

@Kirk-1 commented on GitHub (Jun 18, 2018):

Thanks again. It seems the problem occurs when I declare an instance of WiFiManager globally. I need to use wifiManager.process() in my loop and so it wont compile unless I declare wifiManager in the loop. But declaring and redeclaring wifiManager continuously in the loop isn't going to work either. I noticed that the same error occurs in the "OnDemandConfigPortal" example because, it would seem, the WiFiManager is declared globally. I am using the development version of WIFiManager.

<!-- gh-comment-id:397928303 --> @Kirk-1 commented on GitHub (Jun 18, 2018): Thanks again. It seems the problem occurs when I declare an instance of WiFiManager globally. I need to use wifiManager.process() in my loop and so it wont compile unless I declare wifiManager in the loop. But declaring and redeclaring wifiManager continuously in the loop isn't going to work either. I noticed that the same error occurs in the "OnDemandConfigPortal" example because, it would seem, the WiFiManager is declared globally. I am using the development version of WIFiManager.
Author
Owner

@Kirk-1 commented on GitHub (Jun 18, 2018):

Can I enable debug compile flags easily using Arduino?

<!-- gh-comment-id:397928421 --> @Kirk-1 commented on GitHub (Jun 18, 2018): Can I enable debug compile flags easily using Arduino?
Author
Owner

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

I think there is a menu in board settings debug level

<!-- gh-comment-id:398034083 --> @tablatronix commented on GitHub (Jun 18, 2018): I think there is a menu in board settings debug level
Author
Owner

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

ok I think I know what the problem might be.
I assume you are using the latest esp32 also ?

<!-- gh-comment-id:398092043 --> @tablatronix commented on GitHub (Jun 18, 2018): ok I think I know what the problem might be. I assume you are using the latest esp32 also ?
Author
Owner

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

esp32 introduced some new bugs, I just fixed them ( or rather worked around them )
Give it a try now.

The wifimanager constructor calls
getmode (causing the nvs_open failure error )
and persistent(false) which when called before esp32 calls wifiLowLevelInit(_persistent) now turns off flash storage of persistent, even if you change it later.

<!-- gh-comment-id:398119366 --> @tablatronix commented on GitHub (Jun 18, 2018): esp32 introduced some new bugs, I just fixed them ( or rather worked around them ) Give it a try now. The wifimanager constructor calls getmode (causing the nvs_open failure error ) and persistent(false) which when called before esp32 calls wifiLowLevelInit(_persistent) now turns off flash storage of persistent, even if you change it later.
Author
Owner

@Kirk-1 commented on GitHub (Jun 19, 2018):

That did it! Thank you very much!

<!-- gh-comment-id:398305690 --> @Kirk-1 commented on GitHub (Jun 19, 2018): That did it! Thank you very much!
Author
Owner

@xserg commented on GitHub (Jun 28, 2018):

@tablatronix Hi! Can you pls add some example for non- blocking case?

<!-- gh-comment-id:400948179 --> @xserg commented on GitHub (Jun 28, 2018): @tablatronix Hi! Can you pls add some example for non- blocking case?
Author
Owner

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

You can check the ondemandwebportal example

<!-- gh-comment-id:401012973 --> @tablatronix commented on GitHub (Jun 28, 2018): You can check the ondemandwebportal example
Author
Owner

@xserg commented on GitHub (Jun 28, 2018):

Have an issue with wifisave - it crashes esp on develop branch, on master it ok. tested on Nodemcu esp12 and D1 R1 mini
wifisave page time outed, credentials not saved

<!-- gh-comment-id:401032914 --> @xserg commented on GitHub (Jun 28, 2018): Have an issue with wifisave - it crashes esp on develop branch, on master it ok. tested on Nodemcu esp12 and D1 R1 mini wifisave page time outed, credentials not saved
Author
Owner

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

what esp version?
Which example?

<!-- gh-comment-id:401036040 --> @tablatronix commented on GitHub (Jun 28, 2018): what esp version? Which example?
Author
Owner

@xserg commented on GitHub (Jun 28, 2018):

esp 2.4.1,
esp 12f nodemcu
autoconnect example and my scetch works the same, cant save setting and cant open wifisave from info page
Thanks

<!-- gh-comment-id:401117453 --> @xserg commented on GitHub (Jun 28, 2018): esp 2.4.1, esp 12f nodemcu autoconnect example and my scetch works the same, cant save setting and cant open wifisave from info page Thanks
Author
Owner

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

do you get a exception or dump?

<!-- gh-comment-id:401119070 --> @tablatronix commented on GitHub (Jun 28, 2018): do you get a exception or dump?
Author
Owner

@xserg commented on GitHub (Jun 29, 2018):

WM: <- HTTP WiFi save
WM: Parameters
WM: --------------------
WM: server: mqtt.
****
*WM: port: 1883
*WM: username: **********
*WM: password: ***********
*WM: --------------------

Exception (3):
epc1=0x40217eb8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x402521a2 depc=0x00000000
ctx: cont
sp: 3fff0860 end: 3fff0e10 offset: 01a0

stack>>>
3fff0a00: 3ffefcf4 000005d0 3fff0a4c 402144b1
3fff0a10: 3fff2704 00000000 3fff0a4c 402144fe
3fff0a20: 402521a2 00000000 3fff0c30 402143d8
3fff0a30: 3fff2704 00000000 3fff0c30 40211ba9
3fff0a40: 00000000 00000000 00000000 3fff41bc
3fff0a50: 0000001f 0000001b 3fff420c 00000b0f
3fff0a60: 00000b06 00000009 3fff0ab0 4021447f
3fff0a70: 3ffefcf4 000005d0 000005d0 4020c0fc
3fff0a80: 00000002 00000001 3fff2ab4 40216337
3fff0a90: 00000000 00000000 3fff2ab4 4020c0f2
3fff0aa0: 3fff2ab4 3fff2748 3fff2ab4 4020c12e
3fff0ab0: 00000000 00000000 00000000 402145dc
3fff0ac0: 3fff2ab4 3fff2748 3fff2704 4020c1b5
3fff0ad0: 3fff3914 0000000f 00000009 00000000
3fff0ae0: 00000000 00000000 3fff2708 4020a424
3fff0af0: 00000057 00000001 00000001 00000001
3fff0b00: 00000002 3fff2f64 00000057 3fff2ab4
3fff0b10: 00000000 3fff31a4 3fff2704 3ffe8d89
3fff0b20: 00000001 3fff272c 3fff2704 4020c404
3fff0b30: 00000000 00000001 3fff23fc 4020b3ad
3fff0b40: 00000000 3fff31a4 3fff0c30 402143d8
3fff0b50: 00000000 00000001 3fff0c30 4021200b
3fff0b60: 00000000 00000000 3ffefdf0 00000001
3fff0b70: 00000000 3ffe8d89 40214f7c 3ffefdf0
3fff0b80: 00000000 00000001 3fff0c30 40214ff4
3fff0b90: 00000000 00000001 3fff0c30 40212b1d
3fff0ba0: 4025208e 00000199 00000199 4010020c
3fff0bb0: 3ffe8c03 3ffefad0 3fff0bec 3ffe8d89
3fff0bc0: 3ffe8d89 3ffefad0 3fff0c30 4020fe96
3fff0bd0: 3ffe8c03 3ffefad0 3fff0c30 40212cd0
3fff0be0: 00000000 00000000 00000000 00000000
3fff0bf0: 00000000 00000000 3fff0c30 4020f514
3fff0c00: 00000000 00000001 0000005f 40212d29
3fff0c10: feefeffe feefeffe 00000000 3ffef929
3fff0c20: 3ffe8544 3ffefd1c 3fff0d30 40208da0
3fff0c30: 3fff23fc 3fff2704 3fff1fb4 3fff1fb7
3fff0c40: 3fff1fb8 3fff1f2c 3fff1f38 3fff1f38
3fff0c50: 40107338 00000000 40107338 00000000
3fff0c60: 40107338 00000000 40107338 00000000
3fff0c70: 40107338 00000000 40107338 00000000
3fff0c80: 40107338 00000000 feef5035 3fff1f3c
3fff0c90: 0000000f 00000004 3fff1f54 0000000f
3fff0ca0: 00000000 3fff1f6c 0000000f 00000002
3fff0cb0: 3fff1f84 0000000f 0000000a 00000000
3fff0cc0: 00000000 00000000 00008210 0000821a
3fff0cd0: 00000001 3fff1f9c 0000000f 00000003
3fff0ce0: feefef00 00000001 000042d5 000007d0
3fff0cf0: feefef07 ffffffff 00000000 00000000
3fff0d00: 01000001 00010101 01010001 feefef01
3fff0d10: 3ffe8c03 3ffe8c03 00000001 01000000
3fff0d20: 01000000 00007531 00000004 00000005
3fff0d30: 3fff1fbc feef0201 3ffefd1c feefeffe
3fff0d40: feefeffe 00000000 feefeffe 40207020
3fff0d50: 3ffefd1c 40215f70 40215f5c 3ffe8c51
3fff0d60: 3ffe8c51 3fff1f04 00000020 00000001
3fff0d70: 3ffe8c03 3ffe8c48 3ffe8c48 3fff1edc
3fff0d80: 00000020 00000001 3ffe8c03 3ffe8d3b
3fff0d90: 3ffe8d36 3fff1ecc 00000005 00000001
3fff0da0: 3ffe8c03 3ffe8d2f 3ffe8d2a 3fff1e9c
3fff0db0: 00000028 00000001 3ffe8c03 40207020
3fff0dc0: feefeffe 40215f70 40215f5c feefeffe
3fff0dd0: 00000000 feefeffe feefeffe feefeffe
3fff0de0: feefeffe feefeffe feefeffe 3ffefddc
3fff0df0: 3fffdad0 00000000 3ffefdd4 40214fc0
3fff0e00: feefeffe feefeffe 3ffefdf0 40100710
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

<!-- gh-comment-id:401258456 --> @xserg commented on GitHub (Jun 29, 2018): *WM: <- HTTP WiFi save *WM: Parameters *WM: -------------------- *WM: server: mqtt.******** *WM: port: 1883 *WM: username: ********** *WM: password: *********** *WM: -------------------- Exception (3): epc1=0x40217eb8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x402521a2 depc=0x00000000 ctx: cont sp: 3fff0860 end: 3fff0e10 offset: 01a0 >>>stack>>> 3fff0a00: 3ffefcf4 000005d0 3fff0a4c 402144b1 3fff0a10: 3fff2704 00000000 3fff0a4c 402144fe 3fff0a20: 402521a2 00000000 3fff0c30 402143d8 3fff0a30: 3fff2704 00000000 3fff0c30 40211ba9 3fff0a40: 00000000 00000000 00000000 3fff41bc 3fff0a50: 0000001f 0000001b 3fff420c 00000b0f 3fff0a60: 00000b06 00000009 3fff0ab0 4021447f 3fff0a70: 3ffefcf4 000005d0 000005d0 4020c0fc 3fff0a80: 00000002 00000001 3fff2ab4 40216337 3fff0a90: 00000000 00000000 3fff2ab4 4020c0f2 3fff0aa0: 3fff2ab4 3fff2748 3fff2ab4 4020c12e 3fff0ab0: 00000000 00000000 00000000 402145dc 3fff0ac0: 3fff2ab4 3fff2748 3fff2704 4020c1b5 3fff0ad0: 3fff3914 0000000f 00000009 00000000 3fff0ae0: 00000000 00000000 3fff2708 4020a424 3fff0af0: 00000057 00000001 00000001 00000001 3fff0b00: 00000002 3fff2f64 00000057 3fff2ab4 3fff0b10: 00000000 3fff31a4 3fff2704 3ffe8d89 3fff0b20: 00000001 3fff272c 3fff2704 4020c404 3fff0b30: 00000000 00000001 3fff23fc 4020b3ad 3fff0b40: 00000000 3fff31a4 3fff0c30 402143d8 3fff0b50: 00000000 00000001 3fff0c30 4021200b 3fff0b60: 00000000 00000000 3ffefdf0 00000001 3fff0b70: 00000000 3ffe8d89 40214f7c 3ffefdf0 3fff0b80: 00000000 00000001 3fff0c30 40214ff4 3fff0b90: 00000000 00000001 3fff0c30 40212b1d 3fff0ba0: 4025208e 00000199 00000199 4010020c 3fff0bb0: 3ffe8c03 3ffefad0 3fff0bec 3ffe8d89 3fff0bc0: 3ffe8d89 3ffefad0 3fff0c30 4020fe96 3fff0bd0: 3ffe8c03 3ffefad0 3fff0c30 40212cd0 3fff0be0: 00000000 00000000 00000000 00000000 3fff0bf0: 00000000 00000000 3fff0c30 4020f514 3fff0c00: 00000000 00000001 0000005f 40212d29 3fff0c10: feefeffe feefeffe 00000000 3ffef929 3fff0c20: 3ffe8544 3ffefd1c 3fff0d30 40208da0 3fff0c30: 3fff23fc 3fff2704 3fff1fb4 3fff1fb7 3fff0c40: 3fff1fb8 3fff1f2c 3fff1f38 3fff1f38 3fff0c50: 40107338 00000000 40107338 00000000 3fff0c60: 40107338 00000000 40107338 00000000 3fff0c70: 40107338 00000000 40107338 00000000 3fff0c80: 40107338 00000000 feef5035 3fff1f3c 3fff0c90: 0000000f 00000004 3fff1f54 0000000f 3fff0ca0: 00000000 3fff1f6c 0000000f 00000002 3fff0cb0: 3fff1f84 0000000f 0000000a 00000000 3fff0cc0: 00000000 00000000 00008210 0000821a 3fff0cd0: 00000001 3fff1f9c 0000000f 00000003 3fff0ce0: feefef00 00000001 000042d5 000007d0 3fff0cf0: feefef07 ffffffff 00000000 00000000 3fff0d00: 01000001 00010101 01010001 feefef01 3fff0d10: 3ffe8c03 3ffe8c03 00000001 01000000 3fff0d20: 01000000 00007531 00000004 00000005 3fff0d30: 3fff1fbc feef0201 3ffefd1c feefeffe 3fff0d40: feefeffe 00000000 feefeffe 40207020 3fff0d50: 3ffefd1c 40215f70 40215f5c 3ffe8c51 3fff0d60: 3ffe8c51 3fff1f04 00000020 00000001 3fff0d70: 3ffe8c03 3ffe8c48 3ffe8c48 3fff1edc 3fff0d80: 00000020 00000001 3ffe8c03 3ffe8d3b 3fff0d90: 3ffe8d36 3fff1ecc 00000005 00000001 3fff0da0: 3ffe8c03 3ffe8d2f 3ffe8d2a 3fff1e9c 3fff0db0: 00000028 00000001 3ffe8c03 40207020 3fff0dc0: feefeffe 40215f70 40215f5c feefeffe 3fff0dd0: 00000000 feefeffe feefeffe feefeffe 3fff0de0: feefeffe feefeffe feefeffe 3ffefddc 3fff0df0: 3fffdad0 00000000 3ffefdd4 40214fc0 3fff0e00: feefeffe feefeffe 3ffefdf0 40100710 <<<stack<<< ets Jan 8 2013,rst cause:2, boot mode:(3,6)
Author
Owner

@vaz83 commented on GitHub (Jul 13, 2018):

Hi, i have a nodeMCU board, parameters work fine without setting the wifiManager no nonblocking. Once i set it to true, it gives exception (3) as resets. Seems that when adding custom parameters is not compatible with nonblocking option. Are you guys fixing this? thanks

<!-- gh-comment-id:404980960 --> @vaz83 commented on GitHub (Jul 13, 2018): Hi, i have a nodeMCU board, parameters work fine without setting the wifiManager no nonblocking. Once i set it to true, it gives exception (3) as resets. Seems that when adding custom parameters is not compatible with nonblocking option. Are you guys fixing this? thanks
Author
Owner

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

Cant fix if I cant reproduce.
Make a new issue with small example.

<!-- gh-comment-id:404988223 --> @tablatronix commented on GitHub (Jul 14, 2018): Cant fix if I cant reproduce. Make a new issue with small example.
Author
Owner

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

I will test some more

<!-- gh-comment-id:404988266 --> @tablatronix commented on GitHub (Jul 14, 2018): I will test some more
Author
Owner

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

I added some overflow fixes try now

<!-- gh-comment-id:404998973 --> @tablatronix commented on GitHub (Jul 14, 2018): I added some overflow fixes try now
Author
Owner

@vaz83 commented on GitHub (Jul 14, 2018):

Will try now and let you know.

<!-- gh-comment-id:405031289 --> @vaz83 commented on GitHub (Jul 14, 2018): Will try now and let you know.
Author
Owner

@vaz83 commented on GitHub (Jul 14, 2018):

Hi tablatronix, i've just tested, not working, now, even the parameters are not showing up, this is my code:

#include <FS.h>
#include <ESP8266WiFi.h> //ESP8266 Core WiFi Library (you most likely already have this in your sketch)
#include <DNSServer.h> //Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h> //Local WebServer used to serve the configuration portal
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager WiFi Configuration Magic
#include <ArduinoJson.h>

WiFiManager wifiManager;
WiFiEventHandler gotIpEventHandler, disconnectedEventHandler;
char mqtt_server[40] = "0.0.0.0";
char mqtt_topicIN[80] ="IOT_Device/IN";
char mqtt_topicOUT[80] ="IOT_Device/OUT";
char mqtt_port[6]  = "1883";

/*
void handleRoot() {
  wifiManager.startWebPortal();
}

void handleReset() {
  server.send(200, "text/plain", "Resetting!");
    //Serial.println("diconnecting client and wifi");
    //client.disconnect();
    wifi_station_disconnect();

  WiFiManager wifiManager;
  wifiManager.resetSettings();
  ESP.reset();
  
}

void handleNotFound(){
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}
*/

void setup()
{
  Serial.begin(115200);
  Serial.println("Setup mode...");
  //wifiManager.resetSettings();
   gotIpEventHandler = WiFi.onStationModeGotIP([](const WiFiEventStationModeGotIP & event)
  {
    Serial.print("Station connected, IP: ");
    Serial.println(WiFi.localIP());
  });

   disconnectedEventHandler = WiFi.onStationModeDisconnected([](const WiFiEventStationModeDisconnected & event)
  {
    Serial.println("Station disconnected!");
  });
  WiFiManagerParameter custom_text1("<p><b>MQTT Settings</b></p>");
  WiFiManagerParameter custom_mqtt_server("server", "Server IP", mqtt_server, 40);
  WiFiManagerParameter custom_mqtt_port("port", "Port", mqtt_port, 6);
  WiFiManagerParameter custom_mqtt_topicIN("topicIn", "Input Topic", mqtt_topicIN, 80);
  WiFiManagerParameter custom_mqtt_topicOUT("topicOut", "Output Topic", mqtt_topicOUT, 80);
  wifiManager.addParameter(&custom_text1);
  wifiManager.addParameter(&custom_mqtt_server);
  wifiManager.addParameter(&custom_mqtt_port);
  wifiManager.addParameter(&custom_mqtt_topicIN);
  wifiManager.addParameter(&custom_mqtt_topicOUT);

  wifiManager.setConfigPortalBlocking(false);
  
  wifiManager.autoConnect("IOT Device");

  
  
  /*
  server.on("/", handleRoot);

  server.on("/inline", []()
  {
    server.send(200, "text/plain", "this works as well");
  });
  server.on("/resetwifi", handleReset);
  server.onNotFound(handleNotFound);
  server.begin();
  */
  Serial.println("HTTP server started");
}



void loop()
{
  wifiManager.process();
 
  Serial.println("hello world");
  // put your main code here, to run repeatedly:
}

Now, even if you take the setConfigPortalBlocking, the parameters are no longer showing up.

In the serial I got this:

*WM: <- Request redirected to captive portal
*WM: <- HTTP Root
*WM: Scan is cached
*WM: <- HTTP Wifi
*WM: Scan is cached
*WM: 1 networks found
*WM: AP: -35 V@Z Wifi
*WM: [ERROR] WiFiManagerParameter is out of scope
*WM: <- Request redirected to captive portal
*WM: <- HTTP Root
*WM: Scan is cached

<!-- gh-comment-id:405032736 --> @vaz83 commented on GitHub (Jul 14, 2018): Hi tablatronix, i've just tested, not working, now, even the parameters are not showing up, this is my code: ```cpp #include <FS.h> #include <ESP8266WiFi.h> //ESP8266 Core WiFi Library (you most likely already have this in your sketch) #include <DNSServer.h> //Local DNS Server used for redirecting all requests to the configuration portal #include <ESP8266WebServer.h> //Local WebServer used to serve the configuration portal #include <WiFiManager.h> //https://github.com/tzapu/WiFiManager WiFi Configuration Magic #include <ArduinoJson.h> WiFiManager wifiManager; WiFiEventHandler gotIpEventHandler, disconnectedEventHandler; char mqtt_server[40] = "0.0.0.0"; char mqtt_topicIN[80] ="IOT_Device/IN"; char mqtt_topicOUT[80] ="IOT_Device/OUT"; char mqtt_port[6] = "1883"; /* void handleRoot() { wifiManager.startWebPortal(); } void handleReset() { server.send(200, "text/plain", "Resetting!"); //Serial.println("diconnecting client and wifi"); //client.disconnect(); wifi_station_disconnect(); WiFiManager wifiManager; wifiManager.resetSettings(); ESP.reset(); } void handleNotFound(){ String message = "File Not Found\n\n"; message += "URI: "; message += server.uri(); message += "\nMethod: "; message += (server.method() == HTTP_GET)?"GET":"POST"; message += "\nArguments: "; message += server.args(); message += "\n"; for (uint8_t i=0; i<server.args(); i++){ message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; } server.send(404, "text/plain", message); } */ void setup() { Serial.begin(115200); Serial.println("Setup mode..."); //wifiManager.resetSettings(); gotIpEventHandler = WiFi.onStationModeGotIP([](const WiFiEventStationModeGotIP & event) { Serial.print("Station connected, IP: "); Serial.println(WiFi.localIP()); }); disconnectedEventHandler = WiFi.onStationModeDisconnected([](const WiFiEventStationModeDisconnected & event) { Serial.println("Station disconnected!"); }); WiFiManagerParameter custom_text1("<p><b>MQTT Settings</b></p>"); WiFiManagerParameter custom_mqtt_server("server", "Server IP", mqtt_server, 40); WiFiManagerParameter custom_mqtt_port("port", "Port", mqtt_port, 6); WiFiManagerParameter custom_mqtt_topicIN("topicIn", "Input Topic", mqtt_topicIN, 80); WiFiManagerParameter custom_mqtt_topicOUT("topicOut", "Output Topic", mqtt_topicOUT, 80); wifiManager.addParameter(&custom_text1); wifiManager.addParameter(&custom_mqtt_server); wifiManager.addParameter(&custom_mqtt_port); wifiManager.addParameter(&custom_mqtt_topicIN); wifiManager.addParameter(&custom_mqtt_topicOUT); wifiManager.setConfigPortalBlocking(false); wifiManager.autoConnect("IOT Device"); /* server.on("/", handleRoot); server.on("/inline", []() { server.send(200, "text/plain", "this works as well"); }); server.on("/resetwifi", handleReset); server.onNotFound(handleNotFound); server.begin(); */ Serial.println("HTTP server started"); } void loop() { wifiManager.process(); Serial.println("hello world"); // put your main code here, to run repeatedly: } ``` Now, even if you take the setConfigPortalBlocking, the parameters are no longer showing up. In the serial I got this: *WM: <- Request redirected to captive portal *WM: <- HTTP Root *WM: Scan is cached *WM: <- HTTP Wifi *WM: Scan is cached *WM: 1 networks found *WM: AP: -35 V@Z Wifi *WM: [ERROR] WiFiManagerParameter is out of scope *WM: <- Request redirected to captive portal *WM: <- HTTP Root *WM: Scan is cached
Author
Owner

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

*WM: [ERROR] WiFiManagerParameter is out of scope

There you go

Your wifiparameter objects need to be global or in scope, once setup exits, the references are broken.

If anyone has better ideas how to do this, I am open to it.

You can make your parameters static, or define them outside of setup

<!-- gh-comment-id:405034147 --> @tablatronix commented on GitHub (Jul 14, 2018): `*WM: [ERROR] WiFiManagerParameter is out of scope` There you go Your wifiparameter objects need to be global or in scope, once setup exits, the references are broken. If anyone has better ideas how to do this, I am open to it. You can make your parameters static, or define them outside of `setup`
Author
Owner

@vaz83 commented on GitHub (Jul 14, 2018):

Hi Tablatronix,
I have done what you said (put the variabes global at the beggining), the error still persists. Like I said, even if I comment the setConfigPortalBlocking(false), no parameters are shown and error *WM: [ERROR] WiFiManagerParameter is out of scope is shown. with the version of WM i had from yesterday it was working fine.

<!-- gh-comment-id:405035456 --> @vaz83 commented on GitHub (Jul 14, 2018): Hi Tablatronix, I have done what you said (put the variabes global at the beggining), the error still persists. Like I said, even if I comment the setConfigPortalBlocking(false), no parameters are shown and error *WM: [ERROR] WiFiManagerParameter is out of scope is shown. with the version of WM i had from yesterday it was working fine.
Author
Owner

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

works for me

#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager

WiFiManager wm;
  WiFiManagerParameter custom_mqtt_server("server", "mqtt server", "servername", 40);
  WiFiManagerParameter custom_mqtt_port("port", "mqtt port", "1234", 6);

void setup() {
    // put your setup code here, to run once:
    Serial.begin(115200);
    delay(3000);

    //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around

    // add a custom input field

  WiFiManagerParameter custom_field("customfield", "Custom Field", "Default Value", 40);
  WiFiManagerParameter custom_token("api_token", "api token", "0123456789", 9); // overflow
  // WiFiManagerParameter custom_tokenb("invalid token", "invalid token", "abcdefghijk", 11);

  //add all your parameters here
  wm.addParameter(&custom_mqtt_server);
  wm.addParameter(&custom_mqtt_port);
  wm.addParameter(&custom_field);
  wm.addParameter(&custom_token);
  // wm.addParameter(&custom_tokenb); // overflow

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

    wm.setConfigPortalBlocking(false);
    if(wm.autoConnect("AutoConnectAP")){
        //if you get here you have connected to the WiFi
        Serial.println("connected...yeey :)");
    }
    else 
    {
        Serial.println("non blocking config portal running");
    }

    wm.startConfigPortal("OnDemandAP");
}

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

<!-- gh-comment-id:405046137 --> @tablatronix commented on GitHub (Jul 14, 2018): works for me ```CPP #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager WiFiManager wm; WiFiManagerParameter custom_mqtt_server("server", "mqtt server", "servername", 40); WiFiManagerParameter custom_mqtt_port("port", "mqtt port", "1234", 6); void setup() { // put your setup code here, to run once: Serial.begin(115200); delay(3000); //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around // add a custom input field WiFiManagerParameter custom_field("customfield", "Custom Field", "Default Value", 40); WiFiManagerParameter custom_token("api_token", "api token", "0123456789", 9); // overflow // WiFiManagerParameter custom_tokenb("invalid token", "invalid token", "abcdefghijk", 11); //add all your parameters here wm.addParameter(&custom_mqtt_server); wm.addParameter(&custom_mqtt_port); wm.addParameter(&custom_field); wm.addParameter(&custom_token); // wm.addParameter(&custom_tokenb); // overflow //reset settings - wipe credentials for testing //wm.resetSettings(); wm.setConfigPortalBlocking(false); if(wm.autoConnect("AutoConnectAP")){ //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } else { Serial.println("non blocking config portal running"); } wm.startConfigPortal("OnDemandAP"); } void loop() { wm.process(); // put your main code here, to run repeatedly: } ```
Author
Owner

@vaz83 commented on GitHub (Jul 14, 2018):

this is giving *WM: [ERROR] WiFiManagerParameter is out of scope .. Am I doing something wrong?

#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager WiFi Configuration Magic

WiFiManager wm;
char mqtt_server[40] = "0.0.0.0";
char mqtt_topicIN[80] ="IOT_Device/IN";
char mqtt_topicOUT[80] ="IOT_Device/OUT";
char mqtt_port[6]  = "1883";

WiFiManagerParameter custom_mqtt_server("server", "Server IP", mqtt_server, 40);
WiFiManagerParameter custom_mqtt_port("port", "Port", mqtt_port, 6);
WiFiManagerParameter custom_mqtt_topicIN("topicIn", "Input Topic", mqtt_topicIN, 80);
WiFiManagerParameter custom_mqtt_topicOUT("topicOut", "Output Topic", mqtt_topicOUT, 80);

void setup()
{
  Serial.begin(115200);
  delay(3000);
  Serial.println("Setup mode...");
  //wifiManager.resetSettings();
 
  wm.addParameter(&custom_mqtt_server);
  wm.addParameter(&custom_mqtt_port);
  wm.addParameter(&custom_mqtt_topicIN);
  wm.addParameter(&custom_mqtt_topicOUT);

  wm.setConfigPortalBlocking(false);

  if(wm.autoConnect("IOT_Device"))
  {
    //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");
  }
  else 
  {
    Serial.println("non blocking config portal running");
  }
  wm.startConfigPortal("IOT_Device"); 
  
}

void loop()
{
  wm.process();
 
  //Serial.println("hello world");
  // put your main code here, to run repeatedly:
}
<!-- gh-comment-id:405055163 --> @vaz83 commented on GitHub (Jul 14, 2018): this is giving *WM: [ERROR] WiFiManagerParameter is out of scope .. Am I doing something wrong? ```cpp #include <WiFiManager.h> //https://github.com/tzapu/WiFiManager WiFi Configuration Magic WiFiManager wm; char mqtt_server[40] = "0.0.0.0"; char mqtt_topicIN[80] ="IOT_Device/IN"; char mqtt_topicOUT[80] ="IOT_Device/OUT"; char mqtt_port[6] = "1883"; WiFiManagerParameter custom_mqtt_server("server", "Server IP", mqtt_server, 40); WiFiManagerParameter custom_mqtt_port("port", "Port", mqtt_port, 6); WiFiManagerParameter custom_mqtt_topicIN("topicIn", "Input Topic", mqtt_topicIN, 80); WiFiManagerParameter custom_mqtt_topicOUT("topicOut", "Output Topic", mqtt_topicOUT, 80); void setup() { Serial.begin(115200); delay(3000); Serial.println("Setup mode..."); //wifiManager.resetSettings(); wm.addParameter(&custom_mqtt_server); wm.addParameter(&custom_mqtt_port); wm.addParameter(&custom_mqtt_topicIN); wm.addParameter(&custom_mqtt_topicOUT); wm.setConfigPortalBlocking(false); if(wm.autoConnect("IOT_Device")) { //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } else { Serial.println("non blocking config portal running"); } wm.startConfigPortal("IOT_Device"); } void loop() { wm.process(); //Serial.println("hello world"); // put your main code here, to run repeatedly: } ```
Author
Owner

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

testing

<!-- gh-comment-id:405055640 --> @tablatronix commented on GitHub (Jul 14, 2018): testing
Author
Owner

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

I dont see it

screen shot 2018-07-14 at 6 12 46 pm

<!-- gh-comment-id:405055715 --> @tablatronix commented on GitHub (Jul 14, 2018): I dont see it ![screen shot 2018-07-14 at 6 12 46 pm](https://user-images.githubusercontent.com/807787/42729064-b0dd7b8e-8791-11e8-9407-445bf8a9a0e8.png)
Author
Owner

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

I am on esp32, should I test on 8266 also ?

<!-- gh-comment-id:405055748 --> @tablatronix commented on GitHub (Jul 14, 2018): I am on esp32, should I test on 8266 also ?
Author
Owner

@vaz83 commented on GitHub (Jul 14, 2018):

Can you please try on the 8266? Is the one I am using

<!-- gh-comment-id:405055827 --> @vaz83 commented on GitHub (Jul 14, 2018): Can you please try on the 8266? Is the one I am using
Author
Owner

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

Will do

<!-- gh-comment-id:405060327 --> @tablatronix commented on GitHub (Jul 15, 2018): Will do
Author
Owner

@vaz83 commented on GitHub (Jul 15, 2018):

Hi tablatronix, were you able to test it on the esp8266 ? Parameters are not showing up :(

<!-- gh-comment-id:405076176 --> @vaz83 commented on GitHub (Jul 15, 2018): Hi tablatronix, were you able to test it on the esp8266 ? Parameters are not showing up :(
Author
Owner

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

Yeah works fine there as well.

<!-- gh-comment-id:405096699 --> @tablatronix commented on GitHub (Jul 15, 2018): Yeah works fine there as well.
Author
Owner

@vaz83 commented on GitHub (Jul 16, 2018):

It's working only with the version I had from last Friday, when I download the newer version it doesn't work

<!-- gh-comment-id:405289196 --> @vaz83 commented on GitHub (Jul 16, 2018): It's working only with the version I had from last Friday, when I download the newer version it doesn't work
Author
Owner

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

This was just patched this morning, there was a bug if you were not setting a default value, maybe that was causing an issue.

<!-- gh-comment-id:405307759 --> @tablatronix commented on GitHub (Jul 16, 2018): This was just patched this morning, there was a bug if you were not setting a default value, maybe that was causing an issue.
Author
Owner

@xserg commented on GitHub (Aug 19, 2018):

Hi!
Thank you much for patching, it works fine now. Can you pls check setConfigPortalTimeout with setConfigPortalBlocking(false);
The issue when config portal never disconnected.
In case the router switched off, and esp rebooted in this time, config portal will start and never disconnected after time out and router up. (esp8266 12)
Thanks

<!-- gh-comment-id:414112189 --> @xserg commented on GitHub (Aug 19, 2018): Hi! Thank you much for patching, it works fine now. Can you pls check setConfigPortalTimeout with setConfigPortalBlocking(false); The issue when config portal never disconnected. In case the router switched off, and esp rebooted in this time, config portal will start and never disconnected after time out and router up. (esp8266 12) Thanks
Author
Owner

@tablatronix commented on GitHub (Aug 19, 2018):

setConfigPortalTimeout is not implemented when configPortal is non blocking, because you are in control of it, and can stop it when you want

<!-- gh-comment-id:414128580 --> @tablatronix commented on GitHub (Aug 19, 2018): setConfigPortalTimeout is not implemented when configPortal is non blocking, because you are in control of it, and can stop it when you want
Author
Owner

@xserg commented on GitHub (Sep 24, 2018):

Thank you much for work, It seems in the example, onDemandNonBlocking, setConfigPortalBlocking(false); missing...

<!-- gh-comment-id:424020061 --> @xserg commented on GitHub (Sep 24, 2018): Thank you much for work, It seems in the example, onDemandNonBlocking, setConfigPortalBlocking(false); missing...
Author
Owner

@xserg commented on GitHub (Oct 3, 2018):

Hi @tablatronix, how to setup ap name in noblocking without autoconnect? tnx

<!-- gh-comment-id:426592126 --> @xserg commented on GitHub (Oct 3, 2018): Hi @tablatronix, how to setup ap name in noblocking without autoconnect? tnx
Author
Owner

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

You mean on demand?
Same arguments to startconfogportal as autoconnect

<!-- gh-comment-id:426610721 --> @tablatronix commented on GitHub (Oct 3, 2018): You mean on demand? Same arguments to startconfogportal as autoconnect
Author
Owner

@tablatronix commented on GitHub (Jan 20, 2019):

can this be closed?

<!-- gh-comment-id:455879244 --> @tablatronix commented on GitHub (Jan 20, 2019): can this be closed?
Author
Owner

@vaz83 commented on GitHub (Jan 20, 2019):

Yes

<!-- gh-comment-id:455884513 --> @vaz83 commented on GitHub (Jan 20, 2019): Yes
Author
Owner

@faizakbar18 commented on GitHub (May 20, 2019):

I try using this code,
#500
and get error like this:

Screenshot_1

how to fix it?

NodeMCU v3

<!-- gh-comment-id:494076411 --> @faizakbar18 commented on GitHub (May 20, 2019): I try using this code, [ #500 ](https://github.com/tzapu/WiFiManager/issues/500) and get error like this: ![Screenshot_1](https://user-images.githubusercontent.com/24320262/58039796-ff7bf700-7b5d-11e9-8f81-2b11d2a44e18.jpg) how to fix it? NodeMCU v3
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#319
No description provided.