[enhancement request] Option for non-blocking AutoConnect::begin #499
Replies: 1 comment 1 reply
-
@anishsane I think there are already some answers for your request. Also, the Captive Portal Control section of the documentation may have a combination of configurations that may fit the situation you are looking for. Please consider that first.
The following combinations are possible candidates for configurations that satisfy these conditions. AutoConnect portal;
AutoConnectConfig config;
void setup() {
config.portalTimeout = 1;
config.retainPortal = true;
portal.config(config);
portal.begin():
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
// Here, the process allowed when WiFi is connected
}
// Ordinary sketch processes
// Client loop for AutoConnect
portal.handleClient();
} Your request is ambiguous as a specification to define software functionality. A library tuned to fit only a particular situation (which can often be replaced by convenience for the individual) is not a utility. So, move this topic to the Discussions. If you would like to continue discussing the details of your enhancement request, please visit there. |
Beta Was this translation helpful? Give feedback.
-
Based on the flowchart on the lsbegin.html page, the
begin
function is a blocking function.That means, the
loop
section of the code will not start executing till we finish theportal.begin
function from thesetup
function.Many times, the wifi connection is used only for configuring some parameters and the sketch can continue on its own without wifi.
(e.g. IR remote controlled bulb - we need to save the button codes to EEPROM via http, but after that, we don't need the network for day-to-day operation.)
In such a case, we have to wait for the wifi connection to establish before the loop section can continue.
In absence of Autoconnect, I would just do a
wifi.begin
insetup
and check forif (WiFi.status() == WL_CONNECTED)
in theloop
function to continue the remaining wifi/http/etc setup if any.Can you add this functionality? If there is already a way to do this, please let me know.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions