ADAFRUIT ST7735S (on esp32) RGB vs BGR red and blue inverted

Was getting colors wrong on ST7735 with esp32.
ST7735S screen was with green tab film protector from Aliexpress 128x160 1.8" LCD.
Green was ok, but BLUE and RED were switched.
Spent a lot of time researching no direct solution was found. on web. posting my workaround:

My solution:

  1. in IDE code - use: tft.initR(INITR_VD_TAB);

  2. in Adafruit_ST7735.h >>> add lines: (approx at line 7)
    // some flags for initR() :(
    #define INITR_VD_TAB 0x02 // or maybe better to use 0x09 actually (no overwrite other)

  3. in Adafruit_ST7735.cpp add this option (approx at line 229)

void Adafruit_ST7735::initR(uint8_t options) {
  commonInit(Rcmd1);
  if (options == INITR_VD_TAB) {
    displayInit(Rcmd2red);			// key one to correct colors
    _colstart = 2;					//important to keep 0 pixel at 1st row 1st column
    _rowstart = 1;
  }

...... leave other options in as "else if"
}

Let me know how it worked.

1 Like

it's work! thanks for sharing.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.