E-Ink: additional conditions for "Dynamic Partial" mode #3256
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.
Purpose
Offer more tools for "dynamic partial" code to find the best balance of full-refresh and partial-refresh.
Lay groundwork for imminent pull-requests (Wireless Paper v1.1, sleep screens).
Why
When using partial-refresh, some E-Ink displays struggle to "erase" black pixels - to change an existing black pixel back to white. Rather than returning to white, these "erased" pixels can remain a light shade of gray. This is seen as "ghosting" - a faint version of the previous image remains visible.
The prevalence of this effect varies from display to display.
While working to implement partial-refresh for Heltec Wireless Paper V1.1, it has become clear that "ghosting" is somewhat more of an issue than with the V1.0 board.
What the pull-request implements
Two new "dynamic partial" controls are proposed here:
EINK_PARTIAL_ERASURE_LIMIT
Only active if defined in
variant.h
. Attempts to track the amount of "erased pixels" since last full-refresh. When this amount eventually exceedsEINK_PARTIAL_ERASURE_LIMIT
, ghosting is considered likely to be noticeable, and a full-refresh is forced.The tracking of "erased pixels" is an approximation, by comparing total black pixel count from image to image. Theoretically, an accurate number could be achieved by comparing image buffers pixel-to-pixel, but this would be more intrusive to implement.
demandFullRefresh()
Public method, suitable to call from a
FrameCallback
. Single shot, specifies that the next update is cosmetic (splash screens?), and must be drawn with full-refresh, to maximize image quality. No calls todemandFullRefresh()
are proposed in this specific pull-requestPerformance
Overhead for entire "dynamic partial" code (incl. proposed changes):
LOG_DEBUG()
calls)*Benchmarked on Heltec Wireless Paper
Supporting Media
Demonstration of
EINK_PARTIAL_ERASURE_LIMIT
Highlights a scenario where "erasure limit" applies
EINK_PARTIAL_ERASURE_LIMIT.mp4
Flow Diagram for
determineRefreshMode()
This section edited to correct error in diagram.
![flow diagram for determineRefreshMode()](https://private-user-images.githubusercontent.com/24772776/306603075-d8ac81e7-e3e6-4b88-bb7e-bc7bd1fecbc4.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYwNDYwNDEsIm5iZiI6MTcyNjA0NTc0MSwicGF0aCI6Ii8yNDc3Mjc3Ni8zMDY2MDMwNzUtZDhhYzgxZTctZTNlNi00Yjg4LWJiN2UtYmM3YmQxZmVjYmM0LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTExVDA5MDkwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTczZTlkODQ1YThlMGRiNmZlZTBjMTdkNGY4MTBiZmNkNjAzYzljZjU1MDE2ZDZkYzdhYmQyYjZiNDI2ZjQyN2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Vzg4NUdsGlHZhNQu90Zhf1KLtdVGyQ0bL281mFlsNq0)