docs: Update Power Mgm to change run_every behaviour.#769
docs: Update Power Mgm to change run_every behaviour.#769microbit-carlos merged 2 commits intobbcmicrobit:v2-docsfrom
Conversation
From waking up the board when the next function is scheduled, to allow the scheduled functions to continue running indefinitely while the boards sleeps.
|
@microbit-matt-hillsdon I think with the changes in this PR the only impact to the stubs and translation would be on the @dpgeorge could you confirm this aligns with what we discussed? Also, any suggestions on how to improve the wording are welcomed. |
| # To go sleep and wake up with run_every or button A | ||
| # To go sleep, wake up when button A is pressed, and ensure the | ||
| # function scheduled with run_every still executes in the background | ||
| power.deep_sleep(wake_on=button_a, run_every=True) |
There was a problem hiding this comment.
since run_every=True is the default, does it need to be explicitly specified here?
There was a problem hiding this comment.
No, it's no longer necessary, but I though it'd be good to keep it to be explicit and also so that is clear when reading the example code that the run_every function will continue to run while it sleeps.
It also makes more sense why the parameter it's called run_every when you see the decorator in use.
| 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. |
There was a problem hiding this comment.
The second sentence here is more of an implementation detail, so I suggest making that clear, and giving more detail. Eg:
Implementation note: To make sure the `run_every`'s continue to run, the
micro:bit will wake up from deep sleep 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.
There was a problem hiding this comment.
I think you are right, that paragraph probably contained a bit too much detail, so I tried to simplify it a bit (it says almost the same, but hopefully it's less technical), and then added the technical detail to the "Detailed Information" section in 18dd86d
Yes! |
|
This change was shipped in v2.1.0, so merging to the docs. |
* docs: Update Power Mgm to change run_every behaviour. From waking up the board when the next function is scheduled, to allow the scheduled functions to continue running indefinitely while the boards sleeps. * docs: Tweak Power Mgm run_every description & indicate UART wakeup.
* docs: Update Power Mgm to change run_every behaviour. From waking up the board when the next function is scheduled, to allow the scheduled functions to continue running indefinitely while the boards sleeps. * docs: Tweak Power Mgm run_every description & indicate UART wakeup.
* docs: Update Power Mgm to change run_every behaviour. From waking up the board when the next function is scheduled, to allow the scheduled functions to continue running indefinitely while the boards sleeps. * docs: Tweak Power Mgm run_every description & indicate UART wakeup.
* docs: Update Power Mgm to change run_every behaviour. From waking up the board when the next function is scheduled, to allow the scheduled functions to continue running indefinitely while the boards sleeps. * docs: Tweak Power Mgm run_every description & indicate UART wakeup.
* docs: Update Power Mgm to change run_every behaviour. From waking up the board when the next function is scheduled, to allow the scheduled functions to continue running indefinitely while the boards sleeps. * docs: Tweak Power Mgm run_every description & indicate UART wakeup.
* docs: Update Power Mgm to change run_every behaviour. From waking up the board when the next function is scheduled, to allow the scheduled functions to continue running indefinitely while the boards sleeps. * docs: Tweak Power Mgm run_every description & indicate UART wakeup.
From waking up the board when the next function is scheduled, to allow the scheduled functions to continue running indefinitely while the boards sleeps.
Review URL: https://microbit-micropython--769.org.readthedocs.build/en/769/power.html