diff options
author | Damien George <damien.p.george@gmail.com> | 2018-12-04 10:20:45 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-12-04 10:20:45 +1100 |
commit | 62b4bebf6437df1a1a82747421c1ab94f46c15c2 (patch) | |
tree | fcf5244ab00fa985734210764323811158b22756 | |
parent | 7f948a5645b875ad9d44eda1dcde4aaec2334bd5 (diff) |
esp8266/modnetwork: Wait for iface to go down before forcing power mgmt.
If the STA interface is connected to an AP then it must be fully
disconnected and deactivated before forcing the power management on.
-rw-r--r-- | ports/esp8266/modnetwork.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/esp8266/modnetwork.c b/ports/esp8266/modnetwork.c index 16401c939..6ef2d315d 100644 --- a/ports/esp8266/modnetwork.c +++ b/ports/esp8266/modnetwork.c @@ -89,6 +89,10 @@ STATIC mp_obj_t esp_active(size_t n_args, const mp_obj_t *args) { } error_check(wifi_set_opmode(mode), "Cannot update i/f status"); if (mode == NULL_MODE) { + // Wait for the interfaces to go down before forcing power management + while (wifi_get_opmode() != NULL_MODE) { + ets_loop_iter(); + } wifi_fpm_open(); wifi_fpm_do_sleep(0xfffffff); } |