import time
import alarm
print(time.monotonic())
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 30)
alarm.exit_and_deep_sleep_until_alarms(time_alarm)
If I run this test code, it appears that the monotonic timer is getting reset back to zero on wakeup. I thought I ran this test a few weeks ago and determined the timer keeps going during deep sleep.
I am currently using 8.0.0-beta.4-41-g73a43aa30 on a ESP32-S2 Qt Py. Not sure what version I was using when ran the tests a few weeks ago.
Does the timer reset, or is it supposed to keep going? Not sure which is the intended operation.
time.monotonic() Wakeup from Deep Sleep
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: time.monotonic() Wakeup from Deep Sleep
After chasing through the CircuitPython source, it seems to get into the ESP apis (see https://docs.espressif.com/projects/esp ... timer.html), specifically:
Further reading deeper yields this:int64_t esp_timer_get_time(void)
Get time in microseconds since boot.
Returns
number of microseconds since underlying timer has been started
DaveUnlike gettimeofday function, values returned by esp_timer_get_time():
- Start from zero after the chip wakes up from deep sleep
- Do not have timezone or DST adjustments applied
Please be positive and constructive with your questions and comments.