Skip to content

Commit

Permalink
Fix T4-S3 screen settings window pixel offset
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Jan 29, 2024
1 parent 91a92d3 commit 08b737d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/LilyGo_AMOLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ uint8_t LilyGo_AMOLED::getBrightness()

void LilyGo_AMOLED::setAddrWindow(uint16_t xs, uint16_t ys, uint16_t xe, uint16_t ye)
{
xs += _offset_x;
ys += _offset_y;
xe += _offset_x;
ye += _offset_y;
lcd_cmd_t t[3] = {
{
0x2A00, {
Expand Down Expand Up @@ -878,6 +882,8 @@ void LilyGo_AMOLED::setRotation(uint8_t rotation)
} else if (boards == &BOARD_AMOLED_241) {
switch (_rotation) {
case 1:
_offset_x = 16;
_offset_y = 0;
data = RM690B0_MADCTL_RGB;
_height = boards->display.width;
_width = boards->display.height;
Expand All @@ -888,6 +894,8 @@ void LilyGo_AMOLED::setRotation(uint8_t rotation)
}
break;
case 2:
_offset_x = 0;
_offset_y = 16;
data = RM690B0_MADCTL_MV | RM690B0_MADCTL_MY | RM690B0_MADCTL_RGB;
_height = boards->display.height;
_width = boards->display.width;
Expand All @@ -898,6 +906,8 @@ void LilyGo_AMOLED::setRotation(uint8_t rotation)
}
break;
case 3:
_offset_x = 16;
_offset_y = 0;
data = RM690B0_MADCTL_MX | RM690B0_MADCTL_MY | RM690B0_MADCTL_RGB;
_height = boards->display.width;
_width = boards->display.height;
Expand All @@ -908,6 +918,8 @@ void LilyGo_AMOLED::setRotation(uint8_t rotation)
}
break;
default:
_offset_x = 0;
_offset_y = 16;
data = RM690B0_MADCTL_MX | RM690B0_MADCTL_MV | RM690B0_MADCTL_RGB;
_height = boards->display.height;
_width = boards->display.width;
Expand Down
2 changes: 2 additions & 0 deletions src/LilyGo_Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ class LilyGo_Display
virtual bool hasTouch() = 0;

protected:
uint16_t _offset_x = 0;
uint16_t _offset_y = 0;
uint8_t _rotation;
};

0 comments on commit 08b737d

Please sign in to comment.