From a1c5495219218fe6ee1360160a5428922968d90a Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Tue, 11 Nov 2025 17:48:36 +0100 Subject: [PATCH] set rotation --- src/graphics/EInkParallelDisplay.cpp | 11 ++++++----- src/graphics/EInkParallelDisplay.h | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/graphics/EInkParallelDisplay.cpp b/src/graphics/EInkParallelDisplay.cpp index 1cac06c3a..1dbff0342 100644 --- a/src/graphics/EInkParallelDisplay.cpp +++ b/src/graphics/EInkParallelDisplay.cpp @@ -23,17 +23,17 @@ #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) +EInkParallelDisplay::EInkParallelDisplay(uint16_t width, uint16_t height, EpdRotation rot) : epaper(nullptr), rotation(rot) { LOG_INFO("init EInkParallelDisplay"); // Set dimensions in OLEDDisplay base class this->geometry = GEOMETRY_RAWMODE; - this->displayWidth = EPD_WIDTH; - this->displayHeight = EPD_HEIGHT; + this->displayWidth = width; + this->displayHeight = height; // Round shortest side up to nearest byte, to prevent truncation causing an undersized buffer - uint16_t shortSide = min(EPD_WIDTH, EPD_HEIGHT); - uint16_t longSide = max(EPD_WIDTH, EPD_HEIGHT); + uint16_t shortSide = min(width, height); + uint16_t longSide = max(width, height); if (shortSide % 8 != 0) shortSide = (shortSide | 7) + 1; @@ -91,6 +91,7 @@ bool EInkParallelDisplay::connect() #endif } + epaper->setRotation(rotation); epaper->setMode(BB_MODE_1BPP); epaper->clearWhite(); epaper->fullUpdate(true); diff --git a/src/graphics/EInkParallelDisplay.h b/src/graphics/EInkParallelDisplay.h index 159898009..95d467712 100644 --- a/src/graphics/EInkParallelDisplay.h +++ b/src/graphics/EInkParallelDisplay.h @@ -19,9 +19,9 @@ class EInkParallelDisplay : public OLEDDisplay public: enum EpdRotation { EPD_ROT_LANDSCAPE = 0, - EPD_ROT_PORTRAIT = 1, - EPD_ROT_INVERTED_LANDSCAPE = 2, - EPD_ROT_INVERTED_PORTRAIT = 3, + EPD_ROT_PORTRAIT = 90, + EPD_ROT_INVERTED_LANDSCAPE = 180, + EPD_ROT_INVERTED_PORTRAIT = 270, }; EInkParallelDisplay(uint16_t width, uint16_t height, EpdRotation rotation); @@ -60,6 +60,7 @@ class EInkParallelDisplay : public OLEDDisplay uint32_t ghostPixelLimit = EINK_LIMIT_GHOSTING_PX; #endif + EpdRotation rotation; uint32_t previousImageHash = 0; uint32_t lastUpdateMs = 0; int fastRefreshCount = 0;