feat: add turnOffScreen parameter for sunlight fading fix
Add optional turnOffScreen parameter to displayBuffer() and displayWindow() to allow turning off the screen after refresh, mitigating sunlight fading issues.
This commit is contained in:
parent
dede09001c
commit
be6ba1b62b
@ -42,9 +42,9 @@ class EInkDisplay {
|
||||
void cleanupGrayscaleBuffers(const uint8_t* bwBuffer);
|
||||
#endif
|
||||
|
||||
void displayBuffer(RefreshMode mode = FAST_REFRESH);
|
||||
void displayBuffer(RefreshMode mode = FAST_REFRESH, bool turnOffScreen = false);
|
||||
// EXPERIMENTAL: Windowed update - display only a rectangular region
|
||||
void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||
void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool turnOffScreen = false);
|
||||
void displayGrayBuffer(bool turnOffScreen = false);
|
||||
|
||||
void refreshDisplay(RefreshMode mode = FAST_REFRESH, bool turnOffScreen = false);
|
||||
|
||||
@ -418,8 +418,8 @@ void EInkDisplay::cleanupGrayscaleBuffers(const uint8_t* bwBuffer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void EInkDisplay::displayBuffer(RefreshMode mode) {
|
||||
if (!isScreenOn) {
|
||||
void EInkDisplay::displayBuffer(RefreshMode mode, const bool turnOffScreen) {
|
||||
if (!isScreenOn && !turnOffScreen) {
|
||||
// Force half refresh if screen is off
|
||||
mode = HALF_REFRESH;
|
||||
}
|
||||
@ -451,7 +451,7 @@ void EInkDisplay::displayBuffer(RefreshMode mode) {
|
||||
#endif
|
||||
|
||||
// Refresh the display
|
||||
refreshDisplay(mode);
|
||||
refreshDisplay(mode, turnOffScreen);
|
||||
|
||||
#ifdef EINK_DISPLAY_SINGLE_BUFFER_MODE
|
||||
// In single buffer mode always sync RED RAM after refresh to prepare for next fast refresh
|
||||
@ -464,7 +464,7 @@ void EInkDisplay::displayBuffer(RefreshMode mode) {
|
||||
// EXPERIMENTAL: Windowed update support
|
||||
// Displays only a rectangular region of the frame buffer, preserving the rest of the screen.
|
||||
// Requirements: x and w must be byte-aligned (multiples of 8 pixels)
|
||||
void EInkDisplay::displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
||||
void EInkDisplay::displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h, const bool turnOffScreen) {
|
||||
Serial.printf("[%lu] Displaying window at (%d,%d) size (%dx%d)\n", millis(), x, y, w, h);
|
||||
|
||||
// Validate bounds
|
||||
@ -525,7 +525,7 @@ void EInkDisplay::displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
|
||||
#endif
|
||||
|
||||
// Perform fast refresh
|
||||
refreshDisplay(FAST_REFRESH);
|
||||
refreshDisplay(FAST_REFRESH, turnOffScreen);
|
||||
|
||||
#ifdef EINK_DISPLAY_SINGLE_BUFFER_MODE
|
||||
// Post-refresh: Sync RED RAM with current window (for next fast refresh)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user