Skip to content

Commit 55df14f

Browse files
committed
esp8266/modnetwork: scan() is only supported by STA when it's enabled.
1 parent 715ee9d commit 55df14f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

esp8266/modnetwork.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,10 @@ STATIC void esp_scan_cb(scaninfo *si, STATUS status) {
155155
}
156156

157157
STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
158-
if (wifi_get_opmode() == SOFTAP_MODE) {
158+
require_if(self_in, STATION_IF);
159+
if ((wifi_get_opmode() & STATION_MODE) == 0) {
159160
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError,
160-
"scan unsupported in AP mode"));
161+
"STA must be active"));
161162
}
162163
mp_obj_t list = mp_obj_new_list(0, NULL);
163164
esp_scan_list = &list;

0 commit comments

Comments
 (0)