Chat freely about anything...

User avatar
By SeregaKai
#52977 Hi!
I set force ligth sleep mode in function

void init_force_ligth_sleep(void) {
sint8 st = 0;
ets_uart_printf("Set force sleep mode");
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
wifi_fpm_set_wakeup_cb(wakeup_cb);
wifi_fpm_open();
st = wifi_fpm_do_sleep(5000000);
}


This function are called in the end of user_init().
As result I see in COM terminal periodic reset ESP.
It is not match ligth sleep mode behavior.
May be anybody can help me)
User avatar
By Orcanbull
#53042 HI SeregaKai,

Not sure exactly what is wrong with your code, could be your call of wifi_fpm_open() after the set wakeup, but not sure, I use the following code succesfully,.

If that doesn't solve the problem take a look at your code, note the Delay i have placed after sleep, the ESP tends to continue during Ligh-Sleep and this causes a watch dog reset , resetting on its turn your ESP this could be happening in your code.

Code: Select allvoid fpm_wakup_cb_func1(void)  {
  wifi_fpm_close(); // disable force sleep function
  //wifi_set_opmode(STATION_MODE); // set station mode
  //wifi_station_connect();
  // Serial.println("Woken up...");
}
void sleepNow(int MILI) {
  // Serial.println("Going to sleep...");
  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(MILI * 1000);
  delay(MILI + 10);
}
User avatar
By SeregaKai
#53065
Orcanbull wrote:HI SeregaKai,

Not sure exactly what is wrong with your code, could be your call of wifi_fpm_open() after the set wakeup, but not sure, I use the following code succesfully,.

If that doesn't solve the problem take a look at your code, note the Delay i have placed after sleep, the ESP tends to continue during Ligh-Sleep and this causes a watch dog reset , resetting on its turn your ESP this could be happening in your code.


Thank You very much!
You are rigth!

The my work code for setting sleep mode below:
Code: Select all 
wifi_station_disconnect();
wifi_set_opmode(NULL_MODE); // set WiFi mode to null mode.
wifi_fpm_open(); // enable force sleep
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); // light sleep
wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); // Set wakeup callback
wifi_fpm_do_sleep(60000*1000);