Page 1 of 1

SYSTEM_EVENT_SCAN_DONE may not always arrive

Posted: Mon Oct 22, 2018 3:28 pm
by chrismerck
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!