oreotalks.blogg.se

Esp32 from time import deepsleep
Esp32 from time import deepsleep




esp32 from time import deepsleep

So, if you want to get fancy you can use the header. The ESP32-Arduino support comes with a fairly complete C++ standard library.

#ESP32 FROM TIME IMPORT DEEPSLEEP UPDATE#

If I find out I will update with that information.

esp32 from time import deepsleep esp32 from time import deepsleep

What the actual maximum is for esp_sleep_enable_timer_wakeup is still unclear. The multiplication is therefore carried out in the unsigned long long type, so that the calculation itself accommodates more microseconds than you'll ever know what to do with. The compiler follows something called the usual arithmetic conversions which will cause it to upconvert the long type of DEEP_SLEEP_TIME_SEC to match the unsigned long long that it is finding in 1000000ULL. In esp_sleep_enable_timer_wakeup(1000000ULL * DEEP_SLEEP_TIME_SEC) In practice it means make me an unsigned long long with value 1000000. I don't know what the valid maximum value to call with is, but the original poster confirmed it was large enough for 12 hours.Īn unsigned long long is 64-bit on the ESP32 and the ULL suffix on 1000000ULL forces the compiler to only consider types which are unsigned and which are not smaller than a long long. The long type on ESP32 has a maximum value of 2147483647 which is as you said, "about half an hour" (not quite 36 minutes) worth of microseconds.Īccording to the documentation esp_sleep_enable_timer_wakeup accepts a uint64_t type for its requested duration parameter. The language does not consider the values of the operands (your constant and variable) of an operator (the multiplication) when determining the type of the result (the product) nor what you do with the result after that (passing it to the function). This is attempting to calculate the result of 1000000L * DEEP_SLEEP_TIME_SEC as a long type because both operands are of long type. So, formalizing this into an answer: long DEEP_SLEEP_TIME_SEC = 43200 Įsp_sleep_enable_timer_wakeup(1000000L * DEEP_SLEEP_TIME_SEC)






Esp32 from time import deepsleep