.bmp showing wrong colors on 1.8inch SPI Module ST7735S display

Hi.

I try to find a solution to the problem that this display seems to swap r and b in the rgb channel, so that a blue image turns out red on the display.

I found this description: https://cal-eng.com/?page_id=981, but don't find the file Adafruit_GFX.cpp at the suggested location. Neither do I find the piece of code lines in any of the Adafruit_GFX.cpp files I find in my library, that I am supposed to change:

uint16_t Adafruit_GFX::newColor(uint8_t r, uint8_t g, uint8_t b)

  • where I am supposed to swap uint8_t r and uint8_t b.

Does anyone have another solution to this problem?

I posted a possible solution for the cheap Ebay 160x80 displays in this message

I presume that Adafruit have some different 160x80 panels. Otherwise they would not offer their code examples.

Note that there are several ways to swap the Red and Blue colours.
Likewise, to invert the screen colours.
Probably the only way for the Portrait_Rev and Landscape_Rev pixel alignment.

David.

The problem is that the display has swapped red and blue, so invert do not help much. I need to find a way to swap the red and blue pixels. Is there a library that fixes this issue, or can I do something?

To make it clear:

tft.fill(0,0,0) gives black as expected
tft.fill(255,0,0) should give red, but I get blue)
tft.fill(0,255,0) gives green as expected
tft.fill(0,0,255) gives red, not blue as expected

Link to the display in question: 1.8inch SPI Module ST7735S SKU:MSP1804 - LCD wiki

It seems like the maker of this display has connected the red and blue pixels wrong.

My apologies. I thought you were writing about the small 160x80 displays.

Thanks for the link. It shows exactly which display you have.

There is nothing “wrong” with your display. Different panel manufacturers have different settings.
You select the appropriate panel type in the tft.initR() statement which is usually in setup()
e.g. from C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_ST7735_and_ST7789_Library\examples\graphicstest\graphicstest.ino

void setup(void) {
  Serial.begin(9600);
  Serial.print(F("Hello! ST77xx TFT Test"));

  // Use this initializer if using a 1.8" TFT screen:
  tft.initR(INITR_BLACKTAB);      // Init ST7735S chip, black tab

  // OR use this initializer if using a 1.8" TFT screen with offset such as WaveShare:
  // tft.initR(INITR_GREENTAB);      // Init ST7735S chip, green tab

  // OR use this initializer (uncomment) if using a 1.44" TFT:
  //tft.initR(INITR_144GREENTAB); // Init ST7735R chip, green tab

  // OR use this initializer (uncomment) if using a 0.96" 160x80 TFT:
  //tft.initR(INITR_MINI160x80);  // Init ST7735S mini display
  
  ...

There are several different types e.g. from Adafruit_ST7735.h

#define INITR_GREENTAB 0x00
#define INITR_REDTAB 0x01
#define INITR_BLACKTAB 0x02
#define INITR_18GREENTAB INITR_GREENTAB
#define INITR_18REDTAB INITR_REDTAB
#define INITR_18BLACKTAB INITR_BLACKTAB
#define INITR_144GREENTAB 0x01
#define INITR_MINI160x80 0x04
#define INITR_HALLOWING 0x05

I suspect that you have a BLACKTAB panel.

David.

Thank you very much, David.

BLACKTAB did the trick, I just had to add a setRotation command to orient the display correctly.

I actually had a workaround, while not satisfactory; switching red and blue channels in the BMP images. But it is frustrating to think "bgr" rather than "rgb" while coding.

So thanks again :slight_smile: