Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update Power Mgm to change run_every behaviour. #769

Merged

Conversation

microbit-carlos
Copy link
Collaborator

@microbit-carlos microbit-carlos commented Sep 12, 2022

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

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-carlos
Copy link
Collaborator Author

microbit-carlos commented Sep 12, 2022

@microbit-matt-hillsdon I think with the changes in this PR the only impact to the stubs and translation would be on the run_every parameter description, is that right?

@dpgeorge could you confirm this aligns with what we discussed?

Also, any suggestions on how to improve the wording are welcomed.

display.scroll(temperature())
# 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since run_every=True is the default, does it need to be explicitly specified here?

Copy link
Collaborator Author

@microbit-carlos microbit-carlos Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

docs/power.rst Outdated
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@dpgeorge
Copy link
Member

could you confirm this aligns with what we discussed

Yes!

@microbit-carlos microbit-carlos marked this pull request as ready for review September 26, 2022 17:08
@microbit-carlos
Copy link
Collaborator Author

This change was shipped in v2.1.0, so merging to the docs.

@microbit-carlos microbit-carlos merged commit 2a38b7a into bbcmicrobit:v2-docs Oct 24, 2022
@microbit-carlos microbit-carlos deleted the docs-pwr-runevery branch October 24, 2022 16:54
microbit-carlos added a commit that referenced this pull request Nov 15, 2022
* 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.
microbit-carlos added a commit to microbit-carlos/micropython that referenced this pull request Feb 26, 2024
* 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.
microbit-carlos added a commit that referenced this pull request Feb 26, 2024
* 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.
microbit-carlos added a commit that referenced this pull request May 7, 2024
* 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.
microbit-carlos added a commit that referenced this pull request Jul 18, 2024
* 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.
microbit-carlos added a commit that referenced this pull request Sep 16, 2024
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants