Deep Sleep and Monotonic

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
DaveAZ
 
Posts: 23
Joined: Sun Apr 15, 2018 7:14 pm

Deep Sleep and Monotonic

Post by DaveAZ »

I'm using an ItsyBitsy M4 with with deep sleep for the first time. Since the time-based alarm is set like this:

time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 120),

it implies that the monotonic timer is still running during deep sleep but when my program restarts, it appears that time.monotonic() just returns the time since the processor came out of deep sleep. Is the TimeAlarm method designed that way because some processors do maintain monotonic time through deep sleep and others, like the M4, do not?

Otherwise, I would think that TimeAlarm would just take the amount of time you want to go into deep sleep for (e.g. 60 or 120 seconds) and wouldn't take a a "wake up" time value based on the "absolute" monotonic time value.

Dave

User avatar
danhalbert
 
Posts: 4686
Joined: Tue Aug 08, 2017 12:37 pm

Re: Deep Sleep and Monotonic

Post by danhalbert »

Could you open a GitHub issue about time.monotonic() not advancing during deep sleep? We could run the RTC during sleep (which we may be doing already), and then adjusting the time when we come up from a cold start.

The idea was that you could set an absolute time or a relative time, but as you point out, the semantics don't necessarily make sense.

User avatar
DaveAZ
 
Posts: 23
Joined: Sun Apr 15, 2018 7:14 pm

Re: Deep Sleep and Monotonic

Post by DaveAZ »

Thanks Dan, I'll do that.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”