set rotation

This commit is contained in:
Manuel
2025-11-11 17:48:36 +01:00
parent ee049fd977
commit a1c5495219
2 changed files with 10 additions and 8 deletions

View File

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

View File

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