Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs: Tweak Power Mgm run_every description & indicate UART wakeup.
  • Loading branch information
microbit-carlos committed Sep 26, 2022
commit 18dd86d95a04e644cb0aa43beb4cba11acb942dc
19 changes: 14 additions & 5 deletions docs/power.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ There are two micro:bit board low power modes that can be requested from
MicroPython:

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

The wake up sources are configured via arguments.

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

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

:param ms: A time in milliseconds to wait before it wakes up.
:param wake_on: A single instance or a tuple of pins and/or buttons to
Expand Down Expand Up @@ -130,3 +129,13 @@ the USB connection.
+------------------+-----------------+--------------------+
| **Off** | 📴 Power Down | 📴 Power Down |
+------------------+-----------------+--------------------+

Deep Sleep & run_every
----------------------

To make sure the :py:meth:`microbit.run_every<microbit.run_every>`
functions continue to run during "Deep Sleep", the micro:bit will wake up
at the correct time to run the next scheduled ``run_every``,
and then go back to "Deep Sleep" mode as soon as that ``run_every`` completes.
It will continue to do this until the deep sleep finishes due
to the ``ms`` timeout being reached, or a ``wake_on`` event occurs.