SYSTEM_EVENT_SCAN_DONE may not always arrive

chrismerck
Posts: 76
Joined: Tue May 29, 2018 8:00 pm

SYSTEM_EVENT_SCAN_DONE may not always arrive

Postby chrismerck » Mon Oct 22, 2018 3:28 pm

It is my understanding of the documentation (https://docs.espressif.com/projects/esp ... wi-fi-scan) that after a successful call to esp_wifi_scan_start, we are guaranteed to get a SYSTEM_EVENT_SCAN_DONE event.

However, I've found that if ESP32 is connecting to WiFi when esp_wifi_scan_start is called, the scan seems to be silently canceled, and no SYSTEM_EVENT_SCAN_DONE event is generated.

Therefore, the application is unable to determine whether a scan is still running. The documentation warns against parallel scans, so I'm not sure of the safe way to handle this situation.

The workaround I have used is, if I get no SYSTEM_EVENT_SCAN_DONE event within 10sec of starting the scan, then I assume that the scan has failed and permit another esp_wifi_scan_start call.

Can I treat one of the WiFi state change events as a signal that any in-progress scan has been canceled? The docs do not illuminate this point, and AFAICT the implementation of this part of the WiFi driver is closed source.

Thanks!

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 94 guests