Need help for Light sleep mode[Done]
Need help for Light sleep mode[Done]
Postby rupak426 » Tue Jun 14, 2016 1:38 am
I am trying to make use of light sleep for my ESP-8266-01 with the help of below code:
Serial.println("Wifi_off_timerfunc called to disable wifi");
wifi_station_disconnect();
wifi_set_opmode(NULL_MODE);
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
Serial.println("set the sleep as LIGHT SLEEP");
wifi_fpm_open();
os_timer_disarm(&on_timer);
os_timer_setfn(&on_timer, (os_timer_func_t *)fpm_wakup_cb_func1, NULL);
In the normal mode, I measured the current and its showing 70~80mA.
But when I am measuring the current output after " LIGHT SLEEP (5th line from top)", still the measure current is 70~80mA.
can you let me know if I am missing something while invoking the "LIGHT sleep".
Also can you let me know is there any API to modify the Beacon interval & DTIM interval.
thanks,
Rupak
Re: Need help for Light sleep mode
Postby ESP_Faye » Tue Jun 14, 2016 9:49 am
What is the version of your SDK ?
Please have a try with the ESP8266_NONOS_SDK_V1.5.4, we solved the problem about light sleep.
Re: Need help for Light sleep mode
Postby ESP_Faye » Tue Jun 14, 2016 5:03 pm
timer will prevent the chip from entering light sleep, please do NOT use timer for light sleep.
Sorry for the inconvenience, we will add it in the documentation.
You can use it as the sample code below.
Code: Select all
#define FPM_SLEEP_MAX_TIME 0xFFFFFFF
void fpm_wakup_cb_func1(void)
{
wifi_fpm_close(); // disable force sleep function
wifi_set_opmode(STATION_MODE); // set station mode
wifi_station_connect(); // connect to AP
}
#ifndef SLEEP_MAX
// Wakeup till time out.
void user_func(...)
{
wifi_station_disconnect();
wifi_set_opmode(NULL_MODE); // set WiFi mode to null mode.
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); // light sleep
wifi_fpm_open(); // enable force sleep
wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); // Set wakeup callback
wifi_fpm_do_sleep(50*1000);
}
#else
// Or wake up by GPIO
void user_func(...)
{
wifi_station_disconnect();
wifi_set_opmode(NULL_MODE); // set WiFi mode to null mode.
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); // light sleep
wifi_fpm_open(); // enable force sleep
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U,3);
gpio_pin_wakeup_enable(13, GPIO_PIN_INTR_LOLEVEL);
wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); // Set wakeup callback
wifi_fpm_do_sleep(FPM_SLEEP_MAX_TIME);
...
}
#endif
Re: Need help for Light sleep mode
Postby rupak426 » Tue Jun 14, 2016 5:22 pm
one more query:
can you let me know is there any API to modify the Beacon interval & DTIM interval?
thanks,
Rupak
Re: Need help for Light sleep mode
Postby ESP_Faye » Wed Jun 15, 2016 10:05 am
Code: Select all
struct softap_config {
uint8 ssid[32];
uint8 password[64];
uint8 ssid_len; // Note: Recommend to set it according to your ssid
uint8 channel; // Note: support 1 ~ 13
AUTH_MODE authmode; // Note: Don't support AUTH_WEP in softAP mode.
uint8 ssid_hidden; // Note: default 0
uint8 max_connection; // Note: default 4, max 4
uint16 beacon_interval; // Note: support 100 ~ 60000 ms, default 100
};
bool wifi_softap_set_config(struct softap_config *config);
Thanks for your interest in ESP8266 !
Re: Need help for Light sleep mode[Done]
Postby Mdb » Tue Nov 08, 2016 7:16 pm
I manage to get the forced light sleep following the code provided here.
Two questions :
- you use fpm APIs, is the automatic way to enter light sleep still valid under RTOS SDK ?
- you disconnect the station before forcing the sleep state, light sleep is made to avoid this, i mean, i want let Espressif sleeps WITHOUT loosing the connection to the router ( another espressif acting as TCP Server through AT Binaries), or without the need to reconnect to the router ( it takes time..)
Did I miss something ?
I use the last SDK 1.4.2 ( patched )
Auto - Solved : Using the right API : wifi_set_sleep_type().
This way i see what expected, low current between beacons if no other task are running.
Re: Need help for Light sleep mode[Done]
Postby roc2 » Sat Nov 19, 2016 4:41 pm
We hope that Espressss' enginner can give us suggestion.
Who is online
Users browsing this forum: No registered users and 3 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.