[GH-ISSUE #1452] No way to tell if Exit has been pressed when using (non-)blocking startWebPortal() #1242

Closed
opened 2026-02-28 01:29:11 +03:00 by kerem · 8 comments
Owner

Originally created by @nullstalgia on GitHub (Jul 13, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1452

Basic Infos

Hardware

WiFimanager Branch/Release: Master

Esp8266/Esp32: ESP32

Hardware: ESP32-WROOM

Core Version: ESP32 PlatformIO Core V5.0.0

Description

  • This is also an issue stating that if you use startWebPortal() with blocking enabled, the sketch continues at that point and the web server is unreachable. So I turned blocking off and use process() in the loop()

After the user clicks Exit on the UI, wifiManager.getWebPortalActive() stays true, and wifiManager.getConfigPortalActive() stays false.

abort seems to be the only variable that does change in line, but it is private. I threw in a getAbort() so I could get my project working the way I intend, but hopefully these issues can be addressed in a smarter way. :)

Originally created by @nullstalgia on GitHub (Jul 13, 2022). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1452 ### Basic Infos #### Hardware WiFimanager Branch/Release: Master Esp8266/Esp32: ESP32 Hardware: ESP32-WROOM Core Version: ESP32 PlatformIO Core V5.0.0 ### Description - This is also an issue stating that if you use startWebPortal() with blocking enabled, the sketch continues at that point and the web server is unreachable. So I turned blocking off and use process() in the loop() After the user clicks Exit on the UI, `wifiManager.getWebPortalActive()` stays true, and `wifiManager.getConfigPortalActive()` stays false. `abort` seems to be the only variable that does change in line, but it is private. I threw in a getAbort() so I could get my project working the way I intend, but hopefully these issues can be addressed in a smarter way. :)
kerem 2026-02-28 01:29:11 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Yeah makes sense, exit for webportal is undefined

#1353

<!-- gh-comment-id:1183936172 --> @tablatronix commented on GitHub (Jul 14, 2022): Yeah makes sense, exit for webportal is undefined #1353
Author
Owner

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

I added a WebPortalActive=false fix, as it seemed to be missing, and should get stopped

Another workaround is to override the server->on(WM_G(R_exit), callback.

I guess the ideal solution is to add a exit callback and disable this stuff in non blocking, not sure

<!-- gh-comment-id:1183937325 --> @tablatronix commented on GitHub (Jul 14, 2022): I added a WebPortalActive=false fix, as it seemed to be missing, and should get stopped Another workaround is to override the `server->on(WM_G(R_exit),` callback. I guess the ideal solution is to add a exit callback and disable this stuff in non blocking, not sure
Author
Owner

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

Another solution would be to add enum returns to process() instead of a bool.. for more useful states. I might do this anyway

<!-- gh-comment-id:1183938870 --> @tablatronix commented on GitHub (Jul 14, 2022): Another solution would be to add enum returns to process() instead of a bool.. for more useful states. I might do this anyway
Author
Owner

@nullstalgia commented on GitHub (Jul 14, 2022):

Great, this seems to work! I think once I had it stuck on 0 across reboots before this patch, but a quick test did not reproduce that issue... Could be user error there.

I'll let you close the issue if you wish to use it as a marker for the process() enums.

But I had a quick question: Is there a reason the parameters can not be set in the web portal? It does not affect my use case, so I don't mind, but I was just wondering.

<!-- gh-comment-id:1183956673 --> @nullstalgia commented on GitHub (Jul 14, 2022): Great, this seems to work! I think once I had it stuck on 0 across reboots before this patch, but a quick test did not reproduce that issue... Could be user error there. I'll let you close the issue if you wish to use it as a marker for the process() enums. But I had a quick question: Is there a reason the parameters can not be set in the web portal? It does not affect my use case, so I don't mind, but I was just wondering.
Author
Owner

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

Not sure I understand, can you elaborate what is not working with parameters?

<!-- gh-comment-id:1184426490 --> @tablatronix commented on GitHub (Jul 14, 2022): Not sure I understand, can you elaborate what is not working with parameters?
Author
Owner

@nullstalgia commented on GitHub (Jul 15, 2022):

When connecting to the AP from autoConnect(), the parameters appear in the Setup WiFi page.

When connecting via the local IP when using startWebPortal(), the parameters do not appear in the Setup WiFi page. I assumed this was intentional.

<!-- gh-comment-id:1185055542 --> @nullstalgia commented on GitHub (Jul 15, 2022): When connecting to the AP from autoConnect(), the parameters appear in the Setup WiFi page. When connecting via the local IP when using startWebPortal(), the parameters do not appear in the Setup WiFi page. I assumed this was intentional.
Author
Owner

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

Are you sure its not just because your params are out of scope?

<!-- gh-comment-id:1185074231 --> @tablatronix commented on GitHub (Jul 15, 2022): Are you sure its not just because your params are out of scope?
Author
Owner

@nullstalgia commented on GitHub (Jul 15, 2022):

You are 100% right. That totally went over my head.

Thanks again for the quick help and great library!

<!-- gh-comment-id:1185452289 --> @nullstalgia commented on GitHub (Jul 15, 2022): You are 100% right. That totally went over my head. Thanks again for the quick help and great library!
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#1242
No description provided.