-->
Page 1 of 1

Overlap connect and scan does not work

PostPosted: Fri Jan 06, 2017 6:48 pm
by Neil Young
Hi,

I need to make an async call to scan for Wifi networks. The same time I want to re-connect to the AP. This is because the sequential execution takes too long

Basically I'm starting an async scan and a connect attempt (because I'm waking up from a sleep)

WiFi.scanNetworks(true, true);
wifi_set_opmode(STATION_MODE);
wifi_station_connect();

Depending on the order one of the two operations fail: If it is called like shown, the connection attempt succeeds, but the scan attempt fails (0 results). If I revert the order the scan succeeds, but the connect fails.

I'm pretty sure, this is because the connect function is doing a scan internally. So here is the question: If the connect does that scan, is there any way to participate on the results? I wouldn't have to initiate the scan, the connect would do that.

So is there a "give me the latest scan result" somewhere?

Regards