Light Sleep Wifi disconnect
Posted: Sat May 06, 2017 3:07 pm
Hi,
I'm trying to get my ESP8266 into light sleep state, but as soon as it enters light sleep it disconnects from the wifi. From the documentation it sounds like it should stay connected to the AP. I got my code from a github issue discussion and it loks like this:
I'm trying to get my ESP8266 into light sleep state, but as soon as it enters light sleep it disconnects from the wifi. From the documentation it sounds like it should stay connected to the AP. I got my code from a github issue discussion and it loks like this:
Code: Select all
void callback() {
Serial << "a"<<endl;
Serial.flush();
}
void loop() {
//wifi_station_disconnect(); //not needed
uint32_t sleep_time_in_ms = 2000;
wifi_set_opmode(NULL_MODE);
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
wifi_fpm_open();
wifi_fpm_set_wakeup_cb(callback);
wifi_fpm_do_sleep(sleep_time_in_ms *1000 );
delay(sleep_time_in_ms + 1);
}