WiFi scanning procedure without AP to connect to

Koulwa
Posts: 19
Joined: Wed Feb 07, 2018 11:12 pm

WiFi scanning procedure without AP to connect to

Postby Koulwa » Sun Oct 14, 2018 7:05 am

WiFi Scan is now an issue if you ONLY want to do a WiFi scan.

Lets say i want this following scenario:
- Boot
- Configure wifi driver
- SCAN FOR ACCESS POINTS WITHIN AREA
(IE : There is NO access point to connect to, or want to connect to!)

We used to be able to do this. But with the new updates to idf, in the release notes:
"Fix for scanning during connect process"

if you do that now, you're going to get a : "W (388) wifi: Now is connecting, user scan invalid now!"

In order to set up the wifi correctly, i must specify an access point to connect to. If i specify a wifi network to connect to, i wont be able to scan. So, i do what i found suggested on github: https://github.com/espressif/esp-idf/issues/2497

"so suggestion you invoke a disconnect before start scan so that it can scan"

I can do this. But now i have to wait for the SYSTEM_EVENT_STA_DISCONNECTED event to be raised BEFORE I then call esp_wifi_scan_start

Frustrated that i have to set a wifi in config, wait for a disconnect, THEN do my scan. Seems like either i dont understand how to what i want to do, or its now impossible to do.

Problem is, i don't want to connect to an access point, or would like to do so AFTER i've run my OWN scan. Because if you specify an AP in the wifi config, it will do a scan, but NOT fire the SYSTEM_EVENT_SCAN_DONE event.

Seems like the wifi configuration is forcing you into a few "one use case" scenarios. If you ask me, it should be up to the user when scans should/shouldnt start. If there is an issue while connecting, should raise a warning. Not bounce the new scan entirely.


Does anyone have any real suggestions? Any one tried this and have WORKING code with the LATEST release?
Hive.Tech :: www.hive.technology
Pure Engineering :: www.pureengineering.com

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: WiFi scanning procedure without AP to connect to

Postby WiFive » Sun Oct 14, 2018 9:50 am

Don't put esp_wifi_connect() in your event handler under SYSTEM_EVENT_STA_START

Who is online

Users browsing this forum: No registered users and 101 guests