summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBill Owens <owens.bill@gmail.com>2015-06-10 07:11:34 -0700
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-06-14 10:57:08 +0300
commit3ce212e0a67424c4c89c273e7509be84dc30a172 (patch)
treecd9f25084e50c85ae0d17d5067773458b13a6f5b
parente9ce00d874ef6c93a56e726bb1503341f0448bf9 (diff)
downloadmicropython-3ce212e0a67424c4c89c273e7509be84dc30a172.tar.gz
micropython-3ce212e0a67424c4c89c273e7509be84dc30a172.zip
esp8266: Changed esp_scan to keep the current WiFi operating mode but throw an exception if WiFi is in AP only mode
-rw-r--r--esp8266/modesp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/esp8266/modesp.c b/esp8266/modesp.c
index 3ca7f72715..c1591fea27 100644
--- a/esp8266/modesp.c
+++ b/esp8266/modesp.c
@@ -528,7 +528,10 @@ STATIC void esp_scan_cb(scaninfo *si, STATUS status) {
STATIC mp_obj_t esp_scan(mp_obj_t cb_in) {
MP_STATE_PORT(scan_cb_obj) = cb_in;
- wifi_set_opmode(STATION_MODE);
+ if (wifi_get_opmode() == SOFTAP_MODE) {
+ nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError,
+ "Scan not supported in AP mode"));
+ }
wifi_station_scan(NULL, (scan_done_cb_t)esp_scan_cb);
return mp_const_none;
}