Use single buffer mode for EInkDisplay (#34)

## Summary

* Frees up 48kB of statically allocated RAM in exchange for 48kB just
when grayscale rendering is needed

## Additional Context

* Upstream changes:
https://github.com/open-x4-epaper/community-sdk/pull/7
This commit is contained in:
Dave Allie
2025-12-17 00:17:49 +11:00
committed by GitHub
parent 5d68c8b305
commit c287aa03a4
5 changed files with 67 additions and 21 deletions

View File

@@ -12,6 +12,7 @@ class GfxRenderer {
private:
EInkDisplay& einkDisplay;
RenderMode renderMode;
uint8_t* bwBuffer = nullptr;
std::map<int, EpdFontFamily> fontMap;
void renderChar(const EpdFontFamily& fontFamily, uint32_t cp, int* x, const int* y, bool pixelState,
EpdFontStyle style) const;
@@ -27,6 +28,8 @@ class GfxRenderer {
static int getScreenWidth();
static int getScreenHeight();
void displayBuffer(EInkDisplay::RefreshMode refreshMode = EInkDisplay::FAST_REFRESH) const;
// EXPERIMENTAL: Windowed update - display only a rectangular region (portrait coordinates)
void displayWindow(int x, int y, int width, int height) const;
void invertScreen() const;
void clearScreen(uint8_t color = 0xFF) const;
@@ -49,9 +52,11 @@ class GfxRenderer {
void copyGrayscaleLsbBuffers() const;
void copyGrayscaleMsbBuffers() const;
void displayGrayBuffer() const;
void storeBwBuffer();
void restoreBwBuffer();
// Low level functions
uint8_t* getFrameBuffer() const;
void swapBuffers() const;
static size_t getBufferSize();
void grayscaleRevert() const;
};