You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm really not sure if this is by intention as it's a so obvious bug to me that i really wonder why no one else has stumbled over it, but
according to file Esp.cpp:
@juepi - Just make sure you declare the time correctly for the compiler:
uint64_t time_us1 = 7200000000ull; // works fineuint64_t time_us2 = (uint64_t) 7200 * 1000 * 1000; // works fine//warning: integer overflow in expression of type 'int' results in '-1389934592' [-Woverflow]uint64_t SleepTime = (7200 * 1000 * 1000); // <<<<===== this will not work. Compiler will try to use utin32_t in the right side.// result is actually SleepTime = 2,905,032,704 in 32 bit ===> 18,446,744,072,319,617,024 in 64 bit representation
@juepi - Just make sure you declare the time correctly for the compiler:
uint64_t time_us1 = 7200000000ull; // works fineuint64_t time_us2 = (uint64_t) 7200 * 1000 * 1000; // works fine//warning: integer overflow in expression of type 'int' results in '-1389934592' [-Woverflow]uint64_t SleepTime = (7200 * 1000 * 1000); // <<<<===== this will not work. Compiler will try to use utin32_t in the right side.// result is actually SleepTime = 2,905,032,704 in 32 bit ===> 18,446,744,072,319,617,024 in 64 bit representation
Thanks for the hint @SuGlider, to be honest i managed to step into exactly the described problem when i was calculating my sleep time out of 2 time_t values as soon as i've switched to the uint64_t datatype 😆
But sleeping >2hrs works perfectly well now when calling esp_deep_sleep directly.
Board
WEMOS S2 Mini (occurs probably on any ESP32)
Device Description
no other hardware involved
Hardware Configuration
Nothing special, just testing DeepSleep
Version
latest master (checkout manually)
IDE Name
PlatformIO
Operating System
Windows 11
Flash frequency
default
PSRAM enabled
no
Upload speed
115200
Description
I'm really not sure if this is by intention as it's a so obvious bug to me that i really wonder why no one else has stumbled over it, but
according to file
Esp.cpp
:Where
esp_deep_sleep
expects a uint64_t value (which makes much more sense, as the 32bit value limits sleep time to ~4300 seconds).Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: