-
Notifications
You must be signed in to change notification settings - Fork 44
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
waveshare213v2: Implement partial updates #41
Merged
Merged
Conversation
This file contains 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
This is necessary for partial updates of the display--not just incremental updates of the full display, but updating part of the display in general. On the horizontal axis only whole bytes can be written, so updates need to be aligned to 8 pixels. One option would be to require the caller of Dev.Draw to only operate at multiples of 8. Another would be to read back the contents of bytes to be updated partially and combine the data. According to the datasheet the controller supports that (command 0x27). The simplest option, however, is to maintain a shadow buffer in the driver. Updates are applied to the buffer from which only the changed destination rectangle is sent to the display. The permanent cost is a bit more than 4kB of memory for a 122x250 display while saving on memory allocations for a temporary image buffer on updates. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Merge the common logic in the "initDisplayFull" and "initDisplayPartial" functions and separate out the parts related to the display update mode. In a forthcoming change the update mode will no longer be set when initializing, but rather via a separate setter function, requiring the ability to reconfigure the display controller without a full re-initialization. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
It's perfectly acceptable to update a display in full mode before switching to partial mode and vice-versa. There's no need for a full soft-reset in-between. This change breaks the API: the "Init" function no longer receives a parameter. The default is to always start in the full update mode. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Update both image buffers (B/W and red) and configure the controller to only refresh the changed areas. With this change the "DrawPartial" function becomes equivalent to "Draw" and is thus marked as deprecated. It didn't really provide additional functionality before as partial updates weren't truly implemented. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Codecov Report
@@ Coverage Diff @@
## main #41 +/- ##
=======================================
+ Coverage 62.5% 63.6% +1.1%
=======================================
Files 55 56 +1
Lines 6723 6727 +4
=======================================
+ Hits 4200 4279 +79
+ Misses 2382 2307 -75
Partials 141 141
Continue to review full report at Codecov.
|
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.
This series of changes implements partial, flicker-free update for Waveshare 2.13in v2 displays. Sleep modes and better power management will follow later.