The Wayback Machine - https://web.archive.org/web/20220207031504/https://github.com/adafruit/circuitpython/pull/5352
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

Add supervisor function to poll autoreload status #5352

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

@mscreations
Copy link

@mscreations mscreations commented Sep 15, 2021

This adds a function to supervisor to check what the current autoreload status is from code.py.

@dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Sep 15, 2021

In your code, do you not know if supervisor.disable_autoreload() has been called already or not? Could you explain the use case? Thanks.

@mscreations
Copy link
Author

@mscreations mscreations commented Sep 15, 2021

So the code I'm using launches different apps depending on what keys are held down at boot so at any given time on code.py entry, auto-reload may or may not be known. Specifically, I wish to toggle autoreload on a button press which requires knowledge of the current status to call the correct function. I thought of creating a toggle function instead, but as long as I can determine the current status it's trivial to call the correct function.

Copy link
Collaborator

@MicroDev1 MicroDev1 left a comment

Thanks for the PR @mscreations. I have one suggestion, I think it might be better if autoreload_enabled is done as a property.

@dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Sep 16, 2021

Thanks for the PR @mscreations. I have one suggestion, I think it might be better if autoreload_enabled is done as a property.

We don't have module properties, so it would need to be moved to supervisor.runtime (the sole instance of Runtime). We could then have a single autoreload property to query or set. But it would be a breaking change. We might consider moving other things to there as well if we made this change.

@tannewt
Copy link
Member

@tannewt tannewt commented Sep 16, 2021

You may be able to use sleep memory to store state across the runs of different programs.

@MicroDev1
Copy link
Collaborator

@MicroDev1 MicroDev1 commented Sep 18, 2021

But it would be a breaking change.

Good point, it can be considered for 8.0.0 then.

@tannewt tannewt added this to the 8.0.0 milestone Sep 20, 2021
@MicroDev1 MicroDev1 marked this pull request as draft Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants