From e77f5c4c4d5b383d34852bf6976dbe338a73562b Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Sat, 1 Nov 2025 12:47:40 +0100 Subject: [PATCH] more EPD display cleanup --- src/graphics/EInkParallelDisplay.cpp | 7 +++++-- src/graphics/EInkParallelDisplay.h | 16 +++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/graphics/EInkParallelDisplay.cpp b/src/graphics/EInkParallelDisplay.cpp index bf82ebd4c..1cac06c3a 100644 --- a/src/graphics/EInkParallelDisplay.cpp +++ b/src/graphics/EInkParallelDisplay.cpp @@ -19,6 +19,9 @@ #ifndef EPD_FULLSLOW_PERIOD #define EPD_FULLSLOW_PERIOD 50 // every N full updates do a slow (CLEAR_SLOW) full refresh #endif +#ifndef EPD_RESPONSIVE_MIN_MS +#define EPD_RESPONSIVE_MIN_MS 1000 // simple rate-limit (ms) for responsive updates +#endif EInkParallelDisplay::EInkParallelDisplay(uint16_t width, uint16_t height, EpdRotation rotation) : epaper(nullptr) { @@ -194,7 +197,7 @@ void EInkParallelDisplay::display(void) // Simple rate limiting: avoid very-frequent responsive updates uint32_t nowMs = millis(); - if (lastUpdateMs != 0 && (nowMs - lastUpdateMs) < RESPONSIVE_MIN_MS) { + if (lastUpdateMs != 0 && (nowMs - lastUpdateMs) < EPD_RESPONSIVE_MIN_MS) { LOG_DEBUG("rate-limited, skipping update"); return; } @@ -323,7 +326,7 @@ void EInkParallelDisplay::display(void) } #endif - // Compute page-aligned pixel bounds from newTop/newBottom (pages are 8 pixel rows) + // Compute pixel bounds from newTop/newBottom int startRow = (newTop / 8) * 8; int endRow = (newBottom / 8) * 8 + 7; if (startRow < 0) diff --git a/src/graphics/EInkParallelDisplay.h b/src/graphics/EInkParallelDisplay.h index e2708d8aa..159898009 100644 --- a/src/graphics/EInkParallelDisplay.h +++ b/src/graphics/EInkParallelDisplay.h @@ -47,28 +47,22 @@ class EInkParallelDisplay : public OLEDDisplay void startAsyncFullUpdate(int clearMode); static void asyncFullUpdateTask(void *pvParameters); - // helpers #ifdef EINK_LIMIT_GHOSTING_PX + // helpers void resetGhostPixelTracking(); void markDirtyBits(const uint8_t *prevBuf, uint32_t pos, uint8_t mask, uint8_t out); void countGhostPixelsAndMaybePromote(int &newTop, int &newBottom, bool &forceFull); -#endif - uint32_t previousImageHash = 0; - uint32_t lastUpdateMs = 0; - int fastRefreshCount = 0; - // simple rate-limit (ms) for responsive updates - static constexpr uint32_t RESPONSIVE_MIN_MS = 1000; - // force a slow full update every N full updates - static constexpr int FULL_SLOW_PERIOD = 50; - -#ifdef EINK_LIMIT_GHOSTING_PX // per-bit dirty buffer (same format as epaper buffers): one bit == one pixel uint8_t *dirtyPixels = nullptr; size_t dirtyPixelsSize = 0; uint32_t ghostPixelCount = 0; uint32_t ghostPixelLimit = EINK_LIMIT_GHOSTING_PX; #endif + + uint32_t previousImageHash = 0; + uint32_t lastUpdateMs = 0; + int fastRefreshCount = 0; }; #endif