ST7735_t3 Library - Colors Mismatched

mgaert

Active member
I'm running the graphicstest.ino example. If I change the color of the line
Code:
  testdrawtext("Lorem ipsum dolor sit amet, ...

to ST7735_RED it shows as blue. Most of the other colors are like this except ST7735_MAGENTA which seems correct. The display is a Sitronix ST7796S, "320RGB x 480 dot 262K Color with Frame Memory Single-Chip TFT Controller/Driver."

Thanks for any thoughts and help.
Michael
 
Magenta is equal parts red and blue so it would make sense that it appears normal if they are swapped...
 
So some further details... black, white, green and magenta are correct. Blue, red, cyan and yellow are switched. If they were all switched I would assume it was a setting in the display or the library. But I'm missing something basic I think.

Thanks.
 
Could this be about RGB vs BGR color order? There is a setting for that in the library but I’m not sure how to use it.
 
Haven't been able to set the code to swap colors, seems to be doing BGR. There isn't a specific setting for that, although there are several references to MADCTL_BGR. My display doesn't have a 'tab' and even when I tried to 'break' the library by rewriting the
Less:
writedata_last(...
line here by swapping MADCTL_RGB and MADCTL_BGR a couple ways (original shown):

Code:
void ST7735_t3::setRotation(uint8_t m)
{
    //Serial.printf("Setting Rotation to %d\n", m);
    beginSPITransaction();
    writecommand(ST7735_MADCTL);
    rotation = m % 4; // can't be higher than 3
    switch (rotation) {
    case 0:
         if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
            writedata_last(MADCTL_MX | MADCTL_MY | MADCTL_RGB);
        } else {
            writedata_last(MADCTL_MX | MADCTL_MY | MADCTL_BGR);
        }
        _width  = _screenWidth;
        _height = _screenHeight;
        _xstart = _colstart;
        _ystart = _rowstart;
        break;
    ...

didn't work, no shocker really.

So, any thoughts about how to set this example to flip colors would be helpful.

Thanks.
 
Back
Top