How to light sleep ESP8266 (RTOS SDK)
Posted: Fri Mar 19, 2021 2:14 am
I am developing a data logger with ESP8266 using RTOS SDK and that needs light sleep to be implemented. From this official programming guide (page-36), I have used the following code with the latest functions from esp_sleep.h library.
But when I run this code, for the functions esp_wifi_fpm_set_sleep_type, esp_wifi_fpm_open, esp_wifi_fpm_set_wakeup_cb & esp_wifi_fpm_do_sleep, it prints an error message:
Code: Select all
void fpm_wakup_cb_func1(void){
esp_wifi_fpm_close(); // disable force sleep function
esp_wifi_set_mode(WIFI_MODE_STA); // set station mode
esp_wifi_connect(); // connect to AP
}
esp_wifi_disconnect();
esp_wifi_set_mode(WIFI_MODE_NULL); // set Wi-Fi mode to null mode.
esp_wifi_fpm_set_sleep_type(WIFI_LIGHT_SLEEP_T); // light sleep
esp_wifi_fpm_open(); // enable force sleep
esp_wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); // Set wakeup callback
esp_wifi_fpm_do_sleep(50*1000);
But when I run this code, for the functions esp_wifi_fpm_set_sleep_type, esp_wifi_fpm_open, esp_wifi_fpm_set_wakeup_cb & esp_wifi_fpm_do_sleep, it prints an error message:
FPM: We have removed this api, please do not call. But I could not find any alternate sleep functions. So how can I implement light sleep on ESP8266 with RTOS SDK?