Wait for display on deep sleep #96
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With a MagTag 2025 Edition,
MagTag.exit_and_deep_sleep()
can fail to restart the board if it is called while the display is still updating. I documented this in issue 10639 for CircuitPython.As a workaround, I added a while loop to test
board.DISPLAY.busy
, which enters light sleep while waiting for the display to finish updating. I also added a try/except block around the call tosuper().exit_and_deep_sleep()
since the updated sleep_time value could be negative. Finally, in the exception handling, I callsupervisor.reload()
instead ofmicrocontroller.reset()
because the latter flashes the neopixels, unlike the original behavior ofMagTag.exit_and_deep_sleep()
.