Page 1 of 1

Request clarification of esp_wifi_connect() note in docs

Posted: Tue Oct 02, 2018 3:47 pm
by vonnieda
Hi all,

In the docs at https://docs.espressif.com/projects/esp ... _wifi.html, for esp_wifi_connect() there is the following note:
3. The scanning triggered by esp_wifi_start_scan() will not be effective until connection between ESP32 and the AP is established. If ESP32 is scanning and connecting at the same time, ESP32 will abort scanning and return a warning message and error number ESP_ERR_WIFI_STATE. If you want to do reconnection after ESP32 received disconnect event, remember to add the maximum retry time, otherwise the called scan will not work. This is especially true when the AP doesn’t exist, and you still try reconnection after ESP32 received disconnect event with the reason code WIFI_REASON_NO_AP_FOUND.
I'm particularly interested in the part that I bolded. Can someone provide some clarification on this? I'm wondering if this is related to an issue where sometimes I get WIFI_REASON_NO_AP_FOUND even though the AP is clearly there and other devices can connect to it just fine.

In particular, what does "add the maximum retry time" refer to? And does this apply when making a simple connection, or is it specific to running a scan?

Thanks,
Jason

Re: Request clarification of esp_wifi_connect() note in docs

Posted: Tue Oct 02, 2018 8:55 pm
by WiFive
Specific to scanning, if you don't delay your connect retry you will block your scan.

Re: Request clarification of esp_wifi_connect() note in docs

Posted: Wed Oct 03, 2018 2:14 pm
by vonnieda
WiFive wrote:Specific to scanning, if you don't delay your connect retry you will block your scan.
Thanks WiFive, I think I got it.

Jason