(solved) AP Scan before Wifi Connects?

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

(solved) AP Scan before Wifi Connects?

Postby mzimmers » Wed Aug 26, 2020 2:07 am

Hi all -

I'm writing an app that wants to do an AP scan *before* acquiring a network. The use model would be that the user performs a scan, chooses the desired AP, and connects.

But, I'm getting the impression that this isn't possible. When I try to start a scan, I get this error:
W (42151) wifi:sta_scan: STA is connecting, scan are not allowed!
Do I correctly infer from this that the Wifi module must already be connected before it can do a scan?

Thanks...
Last edited by mzimmers on Fri Sep 04, 2020 2:19 pm, edited 1 time in total.

bbulkow
Posts: 20
Joined: Wed Jan 01, 2020 1:40 am

Re: AP Scan before Wifi Connects?

Postby bbulkow » Fri Sep 04, 2020 9:19 am

I built the following component which allows you to specify multiple networks. It'll scan, pick the network with the highest signal, and attach first. If the connection drops, it'll rescan. This is the same interface used by the WifiMulti arduino interface.

Perhaps it'll give you a hint as to where you are going wrong....

https://github.com/bbulkow/WiFiMulti-idf

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: AP Scan before Wifi Connects?

Postby mzimmers » Fri Sep 04, 2020 2:18 pm

Hi bbulkow -

Thanks for the response, and the link to the interesting example. It turns out that my problem was a bit more fundamental -- I'm something of a Wifi novice, and whenever I was disconnected, I was calling esp_wifi_stop(). Now I know better.

Your example is very nice; I did learn a few things while reading it. Thanks again.

Who is online

Users browsing this forum: Baidu [Spider] and 237 guests