ESP32 deep sleep for 6+ hours

tuadru
Posts: 6
Joined: Tue Dec 07, 2021 10:29 am

ESP32 deep sleep for 6+ hours

Postby tuadru » Thu Aug 22, 2024 7:40 am

Im having trouble with my putting my esp32 to sleep for over 1 hour.
For 1 hour it works but when I try for 6 hours it wakes up every 3-4 minutes or so.

Code: Select all

//ABOVE SETUP
#define uS_TO_S_FACTOR 1000000UL  /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP  21600       /* Time ESP32 will go to sleep (in seconds) */
uint64_t u64SleepLength = TIME_TO_SLEEP * uS_TO_S_FACTOR;/* Time ESP32 will go to sleeps */

//SETUP FUNCTION
esp_sleep_enable_timer_wakeup(u64SleepLength);

//LOOP FUNCTION
esp_deep_sleep_start();
Any suggestion would be greatly appriciated.

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 deep sleep for 6+ hours

Postby ESP_Sprite » Thu Aug 22, 2024 8:10 am

Potentially an overflow... try 1000000ULL instead of 1000000UL?

tuadru
Posts: 6
Joined: Tue Dec 07, 2021 10:29 am

Re: ESP32 deep sleep for 6+ hours

Postby tuadru » Mon Aug 26, 2024 5:50 am

Yeah this was it, I thought if I store it into uint64 it doesn't overflow but I guess it doesn't matter. Thanks.

Who is online

Users browsing this forum: Bing [Bot] and 106 guests