Restore display orientation after Windows resume - #1069
Open
MrSoichi wants to merge 1 commit into
Open
Conversation
|
|
||
| # The LCD controller may lose its configured orientation during sleep/hibernate. | ||
| orientation = _get_theme_orientation() | ||
| logger.info("Restoring display orientation: %s" % orientation.name) |
Owner
There was a problem hiding this comment.
'Restoring display orientation' log is confusing when turn_on() is called at program startup, since it is not really restoring the setting but rather applying it for the first time.
I think it is not necessary to have a log here at all.
Same for the comment l. 142 that speaks of a specific case
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.
Summary
On Windows, some displays can lose their configured orientation after sleep or hibernation and resume in the default orientation.
This was reproduced on a Turing Smart Screen 3.5" Rev. A using reversed portrait orientation.
The Windows resume handler currently calls
display.turn_on(), but orientation is only configured separately during initial display initialization. Rev. A also sendsSetOrientation()directly to the serial port instead of serializing it with the normal display command queue.This PR:
Reproduction
Before this change:
On affected resumes, the display controller can return in its default orientation while the monitoring process continues running. On Rev. A, restoring orientation immediately during resume can also race with queued display updates.
Why
After hibernation, the LCD controller may return to its default orientation while the application itself continues running.
Sending the orientation command immediately during resume can also race with queued redraw/sensor updates on Rev. A.
Serializing the orientation command and allowing the USB endpoint/queue to settle before redraw makes the resume sequence deterministic.
Hardware validation
Tested by Mugen Art Lab on:
DISPLAY_REVERSE: true)The final recovery sequence was exercised through repeated real-world hibernate/resume cycles, including multi-hour hibernation periods. Orientation, background/static content and live sensor updates recovered correctly after resume.
The final test run completed 6 consecutive long hibernate/resume cycles without an orientation failure or incomplete redraw.
Notes
The change is intentionally limited to resume/orientation recovery and does not modify theme configuration or sensor logic.