more EPD display cleanup

This commit is contained in:
Manuel
2025-11-01 12:47:40 +01:00
parent def7d3780f
commit e77f5c4c4d
2 changed files with 10 additions and 13 deletions

View File

@@ -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)

View File

@@ -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