mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #598] Slower than regular connection. #500
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#500
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 @matphillips on GitHub (Apr 24, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/598
Simple code included to demonstrate.
Connecting to the wifi on power up (or wake from deep sleep) is slower when using wifimanager.
The demo sketch takes about 5 second to print the IP address and go to sleep. Press the reset button, watch it do it again in five seconds. Change the define so it does not use wifimanager, and the process takes two seconds.
Arduino 1.8.5
WifiManager 0.12.0
Core 2.4.1
ESP8266's : Wemos D1 and NodeMCU
sample code: (simplified to the extreme, may need a fully featured sketch running first to set the wifimanager settings)
@tzapu commented on GitHub (Apr 24, 2018):
why not start wifimanager only if this fails then?
/edit: i meant that as something i would do if connection time was an issue, eliminate all possible bottlenecks
@matphillips commented on GitHub (Apr 24, 2018):
Interesting, I had no idea that would be possible, I thought the said and password would have to be in the code for the basic wifi to work. I'm testing this out, looks like a good solution.
@matphillips commented on GitHub (Apr 24, 2018):
Yup. Looks good, the following barebones code will connect to wifi if it know about it from the wifimanager, and if it knows nothing or cannot connect after 10 seconds, it will launch wifi manager.
This will work well for my purposes, and may help others.
It's a work around though, but possibly a completely valid one.
@tablatronix commented on GitHub (Apr 24, 2018):
Try development branch?
You also might want to just make sure to add a delay to give wifi a chance to autoconnect before calling wifimanager, since it should not connect at all if already connected.
@matphillips commented on GitHub (Apr 24, 2018):
Thanks, yes, will test the timings with the development branch and see what happens. I tried rolling the changes into my main code and messed it up (!) so will re-check this in the morning and update&close the issue with the results, if that's ok?
@matphillips commented on GitHub (Apr 25, 2018):
Ok, the dev branch has the same timing difference, but I do like the extra features of the dev branch and will keep using it.
For most uses, this makes no real difference, but I'm just working on a battery powered device that spends most of its time asleep, so the that case, being 'awake' for 2 seconds or 5 make a lot of difference.
Using the workaround of trying to connect first, and then failing over to the WiFiManager, is completely good enough, and I doubt I'd have thought of it, so thanks @tzapu for the suggestion.
Will happily close the issue, hopefully this may assist other people sometime.
Thanks.
@tablatronix commented on GitHub (Apr 25, 2018):
Did you disable debugging, serial print is slow
@tablatronix commented on GitHub (Apr 25, 2018):
Ill run some experiments but I am gonna guess that autoconnect is happening while esp is connecting and not connected yet so it redoes the begin
@tablatronix commented on GitHub (Apr 25, 2018):
I have figured out what the delay is.
connectWiFI()
WiFi_Disconnect(); // disconnect before begin, in case anything is hungwe disconnect and reconnect, also I was right wifi is not auto started before autoconnect then we try to connect also. But that is not much of a problem, I get 3-5 seconds with that line , commented out I get 1500-3000 ms
@tablatronix commented on GitHub (Apr 25, 2018):
we can do some optimizations here also
@tablatronix commented on GitHub (Apr 25, 2018):
also f you want to shave ~50-100 ms do not use autogenerated ap names, set one in
autoconnect()and disable debugging@matphillips commented on GitHub (Apr 25, 2018):
Nice one!
I'll set an AP name, every little helps ;)
@tablatronix commented on GitHub (Apr 25, 2018):
I routinely get the same speed as no wifimanasger 1005 ms, sometimes 3000 but that seems to be a fluke, so even with debugging on, that disconnect is the biggest issue.
i will keep this issue open and attempt some resolutions , we can at least make that disconnect optional if we have to .
@tablatronix commented on GitHub (Apr 25, 2018):
It looks like wifi begin sets temp status WL_IDLE_STATUS until either connect or retry fail, i do not know if autoconnect does this however, since it is sdk initiated, I will have to test, it will probably be safer to avoid disconnect, for all i know this workaround is no longer needed woth current versions.
@tablatronix commented on GitHub (Apr 25, 2018):
Commit ref
github.com/tzapu/WiFiManager@179c0309a5I did not say why I added that
@CrappyTan commented on GitHub (Jan 23, 2020):
@tablatronix,
What WiFi kit are you using? Is it Unifi by any chance? I've the exact timing issue. Mostly at 1000ms-ish but sometimes up to 10 seconds. On the bench, when testing, 230ms.
Being battery operated, this is a killer :(
@tablatronix commented on GitHub (Jan 24, 2020):
Ill have to reread the issue but there are several things of note, we disconnect before connecting, this can be disabled and is slow, but more stable.
Some changes to handle the async properties of set mode in the esp lib adds a timer to wait here so it can cause some variability in connect times.
For battery I suggest not using autoconnect! Use your own logic and let esp auto connect and use button actions to launch cp or use a timer before starting it. Also for power saving always use static ip, dhcp is slow