Network scan callback

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
misisnik
Posts: 5
Joined: Wed Jan 17, 2018 7:29 am

Network scan callback

Post by misisnik » Thu Feb 01, 2018 8:33 am

Hello
is it possible to set callback when network scan (get RSSI and MAC address of APs) is in process?

This scan takes at least 2 seconds and in this time I want to do another things with i2c and get the scan result when is done.

Thanks Mike

misisnik
Posts: 5
Joined: Wed Jan 17, 2018 7:29 am

Re: Network scan callback

Post by misisnik » Fri Mar 09, 2018 2:29 pm

Is it possible to do wlan scan faster or to run it with uasincio and pulling data from i2c while wlan scan has running????

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Network scan callback

Post by pythoncoder » Sun Mar 11, 2018 11:28 am

The network.scan method is a blocking function and does not return to the caller until it has results. So uasyncio won't help you: it's a cooperative scheduler which requires non-blocking functions to work in a timely fashion. Your only chance is to use _thread which is a pre-emptive scheduler. Alas I have no experience of this on the ESP8266: the hardware is resource constrained and threading is more demanding than uasyncio. Perhaps others can advise.
Peter Hinch
Index to my micropython libraries.

Post Reply