Open thoredev opened 1 year ago
Width and height changes are missing in the setRotation function. That causes invalid areas for the landscape orientations.
I could solve the error for my display by modifying the function as follows:
void setRotation(uint8_t m) { // m can be 0-3 uint8_t madctl = 0;
_rotation = m % 4;
switch (_rotation) { case 0: madctl = ST7735_MADCTL_MX | ST7735_MADCTL_MY | ST7735_MADCTL_RGB; _height = 160; _width = 128; _xstart = _colstart; _ystart = _rowstart; break; case 1: madctl = ST7735_MADCTL_MY | ST7735_MADCTL_MV | ST7735_MADCTL_RGB; _width = 160; _height = 128; _ystart = _colstart; _xstart = _rowstart; break; case 2: madctl = ST7735_MADCTL_RGB; _height = 160; _width = 128; _xstart = _colstart; _ystart = _rowstart; break; case 3: madctl = ST7735_MADCTL_MX | ST7735_MADCTL_MV | ST7735_MADCTL_RGB; _width = 160; _height = 128; _ystart = _colstart; _xstart = _rowstart; break; } write_command(ST7735_MADCTL); write_data(madctl); }
Thanks for opening the issue. Sounds reasonable. I will add a test-case in the sibling project and test it.
Width and height changes are missing in the setRotation function. That causes invalid areas for the landscape orientations.
I could solve the error for my display by modifying the function as follows:
void setRotation(uint8_t m) { // m can be 0-3 uint8_t madctl = 0;
_rotation = m % 4;
switch (_rotation) { case 0: madctl = ST7735_MADCTL_MX | ST7735_MADCTL_MY | ST7735_MADCTL_RGB; _height = 160; _width = 128; _xstart = _colstart; _ystart = _rowstart; break; case 1: madctl = ST7735_MADCTL_MY | ST7735_MADCTL_MV | ST7735_MADCTL_RGB; _width = 160; _height = 128; _ystart = _colstart; _xstart = _rowstart; break; case 2: madctl = ST7735_MADCTL_RGB; _height = 160; _width = 128; _xstart = _colstart; _ystart = _rowstart; break; case 3: madctl = ST7735_MADCTL_MX | ST7735_MADCTL_MV | ST7735_MADCTL_RGB; _width = 160; _height = 128; _ystart = _colstart; _xstart = _rowstart; break; } write_command(ST7735_MADCTL); write_data(madctl); }