Skip to content

microbit.run_every with power.deep_sleep() with has odd timings #128

Closed
@microbit-carlos

Description

@microbit-carlos

This simple script should wake up every 10 seconds and print the running time to serial.

from microbit import *
import power

@run_every(s=10)
def print_time():
    print(running_time())

while True:
    power.deep_sleep(run_every=True)

This is what I get on a random run with v2.1.0-beta.3:

20176
50176
50179
50182
53838
80177
80180
102019
110176
110178
162895
170175
170178
170182
180176

It doesn't seem very predictable, but mostly looks like it misses a lot of the wake up times from the run_every and double/triple logs the time the next time it wakes up. Running the script next to a stopwatch and the times printed are more or less accurate.

Implementing #118 might also affect this result, but it's a good simple test to run as well while working on that.

Also, at this might be related to some of the CODAL sleep issues, but we need to double check this problem after the CODAL fixes land in the next release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions