Closed tomtobback closed 2 years ago
Hi @tomtobback
Thanks for using the library as well as your nice words.
This is definitely a necessary enhancement and I've already added / tested this new feature and will publish a new release soon. Any other enhancement you'd like to propose?
The library will be certainly better and better thanks to users like you.
Best Regards,
Hi @tomtobback
The new WiFiManager_NINA_Lite releases v1.5.0 has just been published.
Your contribution has been noted in Contributions and Thanks
Please test and see if there is any new issue. You can modify MAX_NUM_WIFI_RECON_TRIES_PER_LOOP
in defined.h
as necessary
// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop()
// Default 1 if not defined, and minimum 1.
//#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2
AVR Mega
Packages' Patches
Hi @khoih-prog many thanks for your prompt follow-up. Unfortunately it does not seem to fix my issue, sorry for the misunderstanding. My goal is to keep the main loop() going without any blocking in between reconnect retries. In my sensor application, i want to catch events (and save to SD), also when wifi is temporarily unavailable. So i would need to have the retries occur only at e.g. 10min intervals, with the loop() running normally (i.e. fast) during that interval. This already works when the Config Portal is active; that does not block the loop().
With the latest release i see this when my one configured SSID becomes unavailable (with Serial Monitor timestamps), and with a print("loop");
in the loop:
08:29:39.586 -> loop
08:29:39.620 -> loop
08:29:39.620 -> loop
08:29:39.653 -> loop
08:29:39.653 -> loop
08:29:39.653 -> loop
08:29:39.686 -> loop
08:29:39.686 -> loop
08:29:39.686 -> loop
08:29:39.719 -> loop
08:29:39.719 -> loop
08:29:39.719 -> loop
08:29:39.719 -> [WN] r:Check&WLost
08:29:39.719 -> [WN] r:WLost.ReconW
08:29:39.719 -> [WN] Ignore invalid WiFi PW : index=1, PW=
08:29:39.719 -> [WN] con2WF:SSID=Cassiopeia,PW=***
08:29:50.285 -> [WN] Failed using index=0, retry_time=0
08:29:50.285 -> [WN] con2WF:failed
08:29:50.319 -> loop
08:29:50.319 -> [WN] r:WLost.ReconW
08:29:50.319 -> [WN] Ignore invalid WiFi PW : index=1, PW=
08:29:50.319 -> [WN] con2WF:SSID=Cassiopeia,PW=***
08:30:00.875 -> [WN] Failed using index=0, retry_time=0
08:30:00.875 -> [WN] con2WF:failed
08:30:00.908 -> loop
08:30:00.908 -> [WN] r:Check&WLost
08:30:00.908 -> [WN] r:WLost.ReconW
08:30:00.908 -> [WN] Ignore invalid WiFi PW : index=1, PW=
08:30:00.908 -> [WN] con2WF:SSID=Cassiopeia,PW=***
08:30:11.454 -> [WN] Failed using index=0, retry_time=0
08:30:11.454 -> [WN] con2WF:failed
08:30:11.487 -> loop
In between the retries, the loop() only runs once, while my aim is to have it run at the usual high speed for a certain interval (e.g. 10min). My sensor application does not work when the loop runs only once per 10 seconds.
Hi @tomtobback
Try the WiFiManager_NINA_Lite releases v1.6.0 and post the results here, OK or not.
You have to modify in defines.h
as follows to have 10mins WIFI_RECON_INTERVAL
// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop()
// Default 1 if not defined, and minimum 1.
#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2
// Default no interval between recon WiFi if lost
// Max permitted interval will be 10mins
// Uncomment to use. Be careful, WiFi reconnect will be delayed if using this method
// Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks.
#define WIFI_RECON_INTERVAL 600000
New instructions are at 13. To avoid blocking in loop when WiFi is lost
Best Regards,
WIFI_RECON_INTERVAL
. Check retries block the main loop #18Hi @khoih-prog - great, that works for me and hopefully others will also find it useful in similar cases. Many thanks.
Thanks for the great work on this library. I have an issue that might not be a bug; in that case it would be a useful feature i think.
When the configured WiFi network becomes unavailable, retries are blocking the loop.
Steps to Reproduce
I'm using
REQUIRE_ONE_SET_SSID_PW true
, and i can configure a single SSID/PWD via the portal and it connects successfully. When i switch off my home AP, the wifimanager keeps trying to reconnect for about 25 seconds, then goes back to the loop but immediately tries again to reconnect, producing and endless loop of:Expected behavior
My application requires the retries to occur only at a certain interval, to allow the main functions of the loop to continue to work even when the wifi connection is down (e.g. polling sensors and saving the data to SD to upload later). I have tried changing
RETRY_TIMES_RECONNECT_WIFI
but that does not accept lower than 2. Would it be possible to define an interval between retries, e.g.RETRY_RECONNECT_WIFI_INTERVAL
in order to allow the application to run in between retries? Or can you suggest a workaround?Also, i'm not seeing the behaviour described in the readme, where the Config Portal is reopened when both SSIDs fail. I set
REQUIRE_ONE_SET_SSID_PW false
and configure 2 SSIDs, and when they both become unavailable, the retries alternate but there is no countdown to the Config Portal.Information