Repository navigation
Conversation
release_epaperdisplay() waited for BUSY while the refresh was still marked in progress. The background task could then see the refresh end during the wait and send the stop sequence. The SSD1680 keeps BUSY set while asleep, so the wait never ended, and alarm deep sleep hung after code.py finished. Mark the refresh done and stop the tick before waiting, so release finishes the refresh and sends the stop sequence itself. Do this in both the legacy and LVGL release_epaperdisplay(). Also reword the comments by each stop sequence send to say that some panels set busy when sleeping, and that the skipped wait is the one after the stop sequence. Fixes adafruit#10639. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dhalbert
force-pushed
the
epaper-deep-sleep-wait
branch
from
November 21, 2026 03:00
29aa081 to
4962dab
Compare
|
Does this solve the problem that Two examples: many Pimoroni boards can shut themselves down, so they don't use deep sleep, they just turn power off. And I have an e-ink from Seeed that has circuitry to power down the panel, which I call before deep-sleep, but after refresh() finished. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Diagnosis, fix, and testing by Claude, with review by @dhalbert.
@gglockner @bablokb How does this fix seem to you?
Problem
release_epaperdisplay()waits for BUSY if a refresh is in progress. The display was still marked as refreshing during that wait, so the background task could see the refresh end and send the stop sequence. The SSD1680 (MagTag 2025 and other recent MagTags) keeps BUSY set while asleep, so the wait never ended.alarm.exit_and_deep_sleep_until_alarms()releases the displays before sleeping, so a refresh still running whencode.pyfinished could hang the board instead of sleeping. The hang was intermittent, because the panel had to finish between the wait loop's read of BUSY and the background task's read.(The IL0373 on older MagTags drives BUSY to its not-busy level while asleep, so it can't hang this way.)
Fix
Mark the refresh done and stop the supervisor tick before waiting. The background task then leaves the display alone, and the release finishes the refresh and sends the stop sequence itself.
Testing
mainhung at the first deep sleep on every boot; with this fix, no hangs.exit_and_deep_sleep_until_alarms(): no hangs.With this fix, adafruit/Adafruit_CircuitPython_MagTag#96 is no longer needed to avoid the hang.