From 9d1d30b69e794ddd42925d739e3d27af83676e78 Mon Sep 17 00:00:00 2001 From: lovyan03 <42724151+lovyan03@users.noreply.github.com> Date: Thu, 21 Sep 2023 15:08:39 +0900 Subject: [PATCH] Corrected Bayer pattern of monochrome OLED --- src/lgfx/v1/panel/Panel_SSD1306.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lgfx/v1/panel/Panel_SSD1306.cpp b/src/lgfx/v1/panel/Panel_SSD1306.cpp index 4b110125..4a490e8c 100644 --- a/src/lgfx/v1/panel/Panel_SSD1306.cpp +++ b/src/lgfx/v1/panel/Panel_SSD1306.cpp @@ -136,11 +136,11 @@ namespace lgfx { x = xs; uint32_t idx = x + (y >> 3) * _cfg.panel_width; - auto btbl = &Bayer[_bayer_offset + ((y & 3) << 2)]; + auto btbl = &Bayer[((y + (_bayer_offset >> 2)) & 3) << 2]; uint32_t mask = 1 << (y&7); do { - bool flg = 256 <= value + btbl[x & 3]; + bool flg = 256 <= value + btbl[(x + _bayer_offset) & 3]; if (flg) _buf[idx] |= mask; else _buf[idx] &= ~ mask; ++idx; @@ -240,7 +240,7 @@ namespace lgfx _rotate_pos(x, y); uint32_t idx = x + (y >> 3) * _cfg.panel_width; uint32_t mask = 1 << (y&7); - bool flg = 256 <= value + Bayer[_bayer_offset + ((x & 3) | (y & 3) << 2)]; + bool flg = 256 <= value + Bayer[ + (((x + _bayer_offset) & 3) | ((y + (_bayer_offset >> 2)) & 3) << 2)]; if (flg) _buf[idx] |= mask; else _buf[idx] &= ~mask; }