esp8266/modnetwork: scan() is only supported by STA when it's enabled.
This commit is contained in:
parent
715ee9d925
commit
55df14f1a4
|
@ -155,9 +155,10 @@ STATIC void esp_scan_cb(scaninfo *si, STATUS status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
|
STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
|
||||||
if (wifi_get_opmode() == SOFTAP_MODE) {
|
require_if(self_in, STATION_IF);
|
||||||
|
if ((wifi_get_opmode() & STATION_MODE) == 0) {
|
||||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError,
|
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError,
|
||||||
"scan unsupported in AP mode"));
|
"STA must be active"));
|
||||||
}
|
}
|
||||||
mp_obj_t list = mp_obj_new_list(0, NULL);
|
mp_obj_t list = mp_obj_new_list(0, NULL);
|
||||||
esp_scan_list = &list;
|
esp_scan_list = &list;
|
||||||
|
|
Loading…
Reference in New Issue