mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1353] EXIT button cannot work in non-blocking mode #1160
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1160
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @stacklover on GitHub (Feb 2, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1353
Basic Infos
Hardware
WiFimanager Branch/Release: Master
The EXIT button in the Portal does not work in non blocking mode, because:
void WiFiManager::handleExit() faithfully sets "abort = true",
but "abort" is only checked in the while(1) loop in blocking mode
if one uses non blocking mode it is not checked and there is no method to read this private variable.
I believe it should be handled in the "boolean WiFiManager::process()" function in a similar way it is handled while in blocking mode?
I will try to do that :)
@tablatronix commented on GitHub (Feb 2, 2022):
I guess the question should be, should it work ? Do we want it to ? Or should it be fixed to allow code to decide what to do via a callout maybe ?
hmm
@stacklover commented on GitHub (Feb 2, 2022):
An EXIT button should work the same way in blocking and non-blocking mode, right?
If one could have a callback function to handle it, it should also work the same.
My solution right now is and works how I would expect it to (added stuff between the "++++++":
/**
[process description]
@access public
@return {[type]} [description]
*/
boolean WiFiManager::process(){
// process mdns, esp32 not required
#if defined(WM_MDNS) && defined(ESP8266)
MDNS.update();
#endif
//+++++++++++++++++++++++
// check for abort set
if(abort){
#ifdef WM_DEBUG_LEVEL
DEBUG_WM(DEBUG_DEV,F("configportal abort"));
#endif
shutdownConfigPortal();
abort = false; // prevent repetitive calling
}
//+++++++++++++++++++++++
if(webPortalActive || (configPortalActive && !_configPortalIsBlocking)){
uint8_t state = processConfigPortal();
return state == WL_CONNECTED;
}
return false;
}
@tablatronix commented on GitHub (Feb 3, 2022):
I mean do you always want to allow an end user to stop portal?
I might have to add access control mechanism
@tablatronix commented on GitHub (Feb 3, 2022):
#982
@stacklover commented on GitHub (Feb 3, 2022):
I think, you miss the point: there is an "EXIT" button automatically presented in the portal. And therefore it should work exactly like an end user expects it to.
It is discussable, whether that button should be displayed optionally, aka "setShowExitButton(bool)", but as long as it is shown it should work.
Currently I am happy having that button and with my small patch it is working as I expect it.
Needless to say, after 2-3 days learning curve, the WiFiManager does exactly what I need for my application:
Thanks for this very good project!
@tablatronix commented on GitHub (Feb 3, 2022):
The menu is customizable, if we let the user add an exit buton say for ondemand use, then we might have to also add security so someone cannot force it to exit when its not allowed.
thanks for the use case, I agree but might add something extra for this for example there is also a close item
@stacklover commented on GitHub (Feb 3, 2022):
This is what I get without doing anything special to have that EXIT button!
If you think, that should not be this way, we have to figure out why it is that way ;)
@stacklover commented on GitHub (Feb 3, 2022):
ALL I do configure is this:
void wifiman_setup() {
wifiManager.setDebugOutput(true);
wifiManager.setSaveParamsCallback(SaveParamsCallback);
wifiManager.setBreakAfterConfig(true);
wifiManager.setConfigPortalBlocking(false);
wifiManager.setShowPassword(true);
wifiManager.setParamsPage(true);
wifiManager.setDarkMode(true);
// Enter all Custom Parameters
for (PARAMETER *p = parameters; p->name != NULL; p++) {
p->wpar = new WiFiManagerParameter(p->name, p->name);
wifiManager.addParameter(p->wpar);
}
@tablatronix commented on GitHub (Feb 3, 2022):
Yes i know sorry, I meant changes going forward and fixing this its already marked as bug, I will have a fix today
#1354
@tablatronix commented on GitHub (Feb 4, 2022):
lol in the code
* HTTPD CALLBACK exit, closes configportal if blocking, if non blocking undefined@stacklover commented on GitHub (Feb 4, 2022):
didn't see that, though I had added a printf there to see whether its called at all ;)