Skip to content

Commit

Permalink
Corrected Bayer pattern of monochrome OLED
Browse files Browse the repository at this point in the history
  • Loading branch information
lovyan03 committed Sep 21, 2023
1 parent b7baca5 commit 9d1d30b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lgfx/v1/panel/Panel_SSD1306.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 9d1d30b

Please sign in to comment.