Network scan is blocking

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Network scan is blocking

Post by pythoncoder » Mon Apr 01, 2019 9:15 am

In my tests on an SF6W a station interface scan (which returns 7 networks here) blocks for ~597ms. This is even worse on the ESP32 where it blocks for 2.5s. It would be good if there were a nonblocking alternative. Or a fast way to check the status of a given SSID.
Peter Hinch
Index to my micropython libraries.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Network scan is blocking

Post by Damien » Wed Apr 03, 2019 8:07 am

Now that the code is available you can see how scan works. You'll notice it's just doing a busy wait at the end of the scan() method. So in principle it's pretty easy to make it non-blocking, it's just a matter of defining how the user-facing Python API looks.

You can also specify a specific (B)SSID for the scan, but from my tests it doesn't make it much faster.

Post Reply