limit Ghosting similar to EInkDynamicDisplay

This commit is contained in:
Manuel
2025-10-31 23:30:35 +01:00
parent 4ceebf6997
commit 49d9a763c5
2 changed files with 249 additions and 6 deletions

View File

@@ -5,6 +5,10 @@
#ifdef USE_EPD
#include <OLEDDisplay.h>
#include <atomic>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
class FASTEPD;
/**
@@ -35,6 +39,36 @@ class EInkParallelDisplay : public OLEDDisplay
protected:
uint32_t lastDrawMsec = 0;
FASTEPD *epaper;
private:
// Async full-refresh support
std::atomic<bool> asyncFullRunning{false};
TaskHandle_t asyncTaskHandle = nullptr;
void startAsyncFullUpdate(int clearMode);
static void asyncFullUpdateTask(void *pvParameters);
// helpers
#ifdef EINK_LIMIT_GHOSTING_PX
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
};
#endif