microbit-foundation / micropython-microbit-v2

Temporary home for MicroPython for micro:bit v2 as we stablise it before pushing upstream
MIT License
41 stars 22 forks source link

Update `power.deep_sleep` to sleep until the next `run_every` #118

Closed microbit-carlos closed 1 year ago

microbit-carlos commented 1 year ago

As discussed elsewhere, my suggestion is that run_every=True does not end the deep_sleep() call, but rather wakes briefly to execute the run every and then resumes the deep sleep. The deep sleep only ends when the given timeout expires, or a wake_on event occurs. In particular, power.deep_sleep(run_every=True) will never return. (And maybe we can then make run_every=True the default.)

Originally posted by @dpgeorge in https://github.com/bbcmicrobit/micropython/issues/754#issuecomment-1232802628

microbit-carlos commented 1 year ago
dpgeorge commented 1 year ago

Implemented by cd8bbb8d089353d6d6f06be25f628b003a1d3330