Repository navigation
fix: power the X4 Pro panel off before every restart - #67
Merged
Merged
Conversation
The panel stays powered between refreshes, and esp_restart() (silent restart, OTA, SD update) left the booster on until the reset. A shutdown handler takes the render lock (bounded 3 s, or proceeds when the caller already holds it) and runs the panel deep sleep (POF + DSLP) first. X4 Pro only: SDMMC keeps SD traffic off the display SPI bus, so the bus lock cannot block the handler; the X3 seamless restart also relies on controller RAM that deep sleep would discard. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XgLRarbAmBVepTPKCK7mgd
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.
Before: the panel stays powered between refreshes, and
esp_restart()(silent restart after Wi-Fi, OTA, SD firmware update) left the booster on until the reset.After: on the X4 Pro, a shutdown handler runs the panel deep sleep (POF + DSLP) before every restart and logs "Panel powered off before restart".
How:
esp_register_shutdown_handleris called afterdisplay.begin(). The handler takes the render lock with a bounded 3 s wait, or proceeds when the calling task already holds it, so it cannot deadlock or cut a refresh short. On timeout it skips the power-off and logs an error.RenderLockgains a timeout constructor andheldByCaller(). Same approach as CrossDink 5fb93c4 + 4341c90.It is X4 Pro only (
FREEINK_DEVICE_X4PRO):begin()re-inits the controller and the first paint after boot is non-differential on both SSD1677 and UC8179 panels.Sizes vs development 2dc4839 (static RAM unchanged on both):
default): flash +80 B (6,296,057 → 6,296,137), mostly the longer branch name in the build info; the handler compiles out. RAM 65,232 → 65,232x4-pro-light-sleep: flash +296 B (5,600,829 → 5,601,125), RAM 118,452 → 118,452Verify on hardware: on an X4 Pro, run an SD firmware update or an OTA. The log should show "Panel powered off before restart" right before the reset, and the next boot should paint normally.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XgLRarbAmBVepTPKCK7mgd
Generated by Claude Code