Skip to content

Commit 18dd86d

Browse files
docs: Tweak Power Mgm run_every description & indicate UART wakeup.
1 parent d93ace5 commit 18dd86d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

docs/power.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ There are two micro:bit board low power modes that can be requested from
99
MicroPython:
1010

1111
- **Deep Sleep**: Low power mode where the board can be woken up via
12-
multiple sources (pins, button presses, or a timer) and resume
12+
multiple sources (pins, button presses, uart data, or a timer) and resume
1313
operation.
1414
- **Off**: The power mode with the lowest power consumption, the only way to
1515
wake up the board is via the reset button, or by plugging the USB cable while
@@ -49,15 +49,14 @@ Functions
4949

5050
The wake up sources are configured via arguments.
5151

52-
If no wake up sources have been configured it will sleep until the reset
52+
The board will always wake up when receiving UART data, when the reset
5353
button is pressed (which resets the board) or, in battery power,
5454
when the USB cable is inserted.
5555

5656
When the ``run_every`` parameter is set to ``True`` (the default), any
5757
function scheduled with :py:meth:`microbit.run_every<microbit.run_every>`
58-
will still run while the board sleeps. When the scheduled time is reached
59-
the micro:bit will momentarily wake up to run the scheduled function
60-
and then automatically go back to sleep.
58+
will momentarily wake up the board to run and when it finishes it will go
59+
back to sleep.
6160

6261
:param ms: A time in milliseconds to wait before it wakes up.
6362
:param wake_on: A single instance or a tuple of pins and/or buttons to
@@ -130,3 +129,13 @@ the USB connection.
130129
+------------------+-----------------+--------------------+
131130
| **Off** | 📴 Power Down | 📴 Power Down |
132131
+------------------+-----------------+--------------------+
132+
133+
Deep Sleep & run_every
134+
----------------------
135+
136+
To make sure the :py:meth:`microbit.run_every<microbit.run_every>`
137+
functions continue to run during "Deep Sleep", the micro:bit will wake up
138+
at the correct time to run the next scheduled ``run_every``,
139+
and then go back to "Deep Sleep" mode as soon as that ``run_every`` completes.
140+
It will continue to do this until the deep sleep finishes due
141+
to the ``ms`` timeout being reached, or a ``wake_on`` event occurs.

0 commit comments

Comments
 (0)