Advanced Users can post their questions and comments here for the not so Newbie crowd.

Moderator: eriksl

User avatar
By davydnorris
#81602
davydnorris wrote:
quackmore wrote:...
Why do you wait 1 second before checking for the next channel?



I'm not - at this point I am not manually initiating any scans, I'm just dropping the channel and trying again. Anything you see there is Espressif's code doing the scanning.

I actually do use the manual custom scan several times. I have a config web app that runs in the unit and I scan all the available Wi-fi points to populate a list for the UI.

I also use that same list to geolocate the unit via the Google Geolocation API - my units are deployed in cities with lots of wifi points and lots of GPS shadows so wifi based triangulation works brilliantly. I can usually get within 10m or so of the actual location, and then I bring up a map in the config app with a pin for precise position refinement.


@quackmore I've just reread your note and see that I entirely misread the second part of it! You weren't asking *me* a question, you were answering your own!

Now I understand the second part and it's a great idea! Right now I just drop the channel info and let Espressif scan for me, but doing my own optimised channel scan as next step may speed things up a lot. I'll put that idea into the list to try!!

Please keep us up to date if you do investigate this!
User avatar
By quackmore
#81617 I performed some measurements on the non-os-sdk wifi_station_scan function.

Time was measured starting before the function call to the first instruction of the callback function.

My wifi area is everything but crowed and my device usually sees 7 different APs over 4 channels.

In this conditions a regular scan (passing config==NULL so without any indication or filter) takes from 1600 ms (say 95% of cases) to 2400 ms (say 5% of cases).

For sure Espressif algorithm does not use the timing I described in my previous post.

But here's the good news for you:
+ performing a single channels scan takes only 60-64 ms (in my scenario 60 when scanning the current wifi channel and a 63-64 when scanning a channel different from the working one).

Additionally:
+ changing the scan_min_time does not seem to affect the total scan time (compared to the values I mentioned at the beginning and setting all other param to 0)
+ changing the scan_max_time affects the total scan time but it's tricky
using 60 ms I got a the same total scan time of a regular scan
using 1 ms I got a total scan time of 820 ms but I lost all the APs on the channels different than the current one :-(
User avatar
By quackmore
#81621 just measured the scan

the device has not even tried to connect yet

once you have selected the channel the ssid and the bssid (or sdk has selected for you) then you connect

but at that point I don't expect timing to vary that much (even if it could depending on ap device vendor)