esp8266,esp32: Include hidden networks in WLAN.scan results.
Addresses issues #2697 and #5329. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
bfc8e88ce1
commit
8616129f2e
|
@ -46,6 +46,8 @@ Methods
|
|||
.. method:: WLAN.scan()
|
||||
|
||||
Scan for the available wireless networks.
|
||||
Hidden networks -- where the SSID is not broadcast -- will also be scanned
|
||||
if the WLAN interface allows it.
|
||||
|
||||
Scanning is only possible on STA interface. Returns list of tuples with
|
||||
the information about WiFi access points:
|
||||
|
|
|
@ -466,7 +466,7 @@ STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
|
|||
|
||||
mp_obj_t list = mp_obj_new_list(0, NULL);
|
||||
wifi_scan_config_t config = { 0 };
|
||||
// XXX how do we scan hidden APs (and if we can scan them, are they really hidden?)
|
||||
config.show_hidden = true;
|
||||
MP_THREAD_GIL_EXIT();
|
||||
esp_err_t status = esp_wifi_scan_start(&config, 1);
|
||||
MP_THREAD_GIL_ENTER();
|
||||
|
|
|
@ -233,7 +233,9 @@ STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
|
|||
}
|
||||
mp_obj_t list = mp_obj_new_list(0, NULL);
|
||||
esp_scan_list = &list;
|
||||
wifi_station_scan(NULL, (scan_done_cb_t)esp_scan_cb);
|
||||
struct scan_config config = {0};
|
||||
config.show_hidden = 1;
|
||||
wifi_station_scan(&config, (scan_done_cb_t)esp_scan_cb);
|
||||
while (esp_scan_list != NULL) {
|
||||
// our esp_scan_cb is called via ets_loop_iter so it's safe to set the
|
||||
// esp_scan_list variable to NULL without disabling interrupts
|
||||
|
|
Loading…
Reference in New Issue