Bodmer / TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
Other
3.65k stars 1.05k forks source link

ST7735 0.96 160x80 display truncated #1308

Closed Boyeen closed 3 years ago

Boyeen commented 3 years ago

I see a lot of Chinese vendors now selling these displays for cheap which appear to be defective.... they have a blue label and under TFT_eSPI, behave like 120x60 displays.... the screen is black at the end furthest from the ribbon. I have been looking into this and have a partial solution but am a babe-in-the-woods on LCD tech. Hopefully someone can help.

First, full disclosure, I got GREAT help from Dave Prentice on the Arduino forum, could not have gotten this far alone. I obtained an 8051 driver from the Chinese vendor and Dave converted it and made a simple test sketch which works, it can access the entire display (80x160) in simple fillRect() drawRect() style. IMHO the problem with these displays seems to be large screen offsets but ALSO that the controller is a clone of ST7735S, the init() code uses several undeclared controller registers/addresses.

My application is a jpg image load of the display in portrait mode. My code works with my "GOOD" displays (ST7735REDTAB). Of course I thought a bunch of $2 displays was too good an opportunity to pass up. More fool me?

I took the init() routine of Daves code and hacked it into ST7735_init(define)(rotate) driver files by adding a temporary INITR_BLUETAB #define. It's working in that I can access the whole display height (160) but my images are offset in the width (80) dimension. As I said, the 8051 code has correct geometry, so perhaps I am abusing Bodmers masterpiece? :-)

IMG_1291

Sorry if I am not using correct LCD terminology... I know these are not simple bitmapped displays, but this is all new to me.

Q1. Where do I start trying to correct the geometry?
Q2. Is there some documentation on how to add/extend a driver?

I am happy to share my code, especially when I get it to work... but this msg has been long enough :-)

Here is the init() code I am using in st7735_init.h:

` if (tabcolor == INITB) { commandList(Bcmd); }else if(tabcolor == INITR_BLUETAB) {

   Serial.println("Initializing a blue display");
writecommand(0xfe);
writecommand(0xfe);
writecommand(0xfe);
writecommand(0xef);

writecommand(0xb3);
writedata(0x03);

writecommand(0x36);
writedata(0xd8);

writecommand(0x3a);
writedata(0x05);

writecommand(0xb6);
writedata(0x11);
writecommand(0xac);
writedata(0x0b);

writecommand(0xb4);
writedata(0x21);

writecommand(0xb1);
writedata(0xc0);

writecommand(0xe6);
writedata(0x50);
writedata(0x43);
writecommand(0xe7);
writedata(0x56);
writedata(0x43);

writecommand(0xF0);
writedata(0x1f);
writedata(0x41);
writedata(0x1B);
writedata(0x55);
writedata(0x36);
writedata(0x3d);
writedata(0x3e);
writedata(0x0);
writedata(0x16);
writedata(0x08);
writedata(0x09);
writedata(0x15);
writedata(0x14);
writedata(0xf);

writecommand(0xF1);

writedata(0x1f);
writedata(0x41);
writedata(0x1B);
writedata(0x55);
writedata(0x36);
writedata(0x3d);
writedata(0x3e);
writedata(0x0);
writedata(0x16);
writedata(0x08);
writedata(0x09);
writedata(0x15);
writedata(0x14);
writedata(0xf);

writecommand(0xfe);
writecommand(0xff);

writecommand(0x35);
writedata(0x00);
writecommand(0x44);
writedata(0x00);
writecommand(0x11);
delay (120);
writecommand(0x29);
//writecommand(0x2c);

writecommand(0x2A); //Set Column Address
writedata(0x00);
writedata(0x18);
writedata(0x00);
writedata(0x00);//(0x67);
writecommand(0x2B); //Set Page Address
writedata(0x00);
writedata(0x00);
writedata(0x00);
writedata(0x9f);
writecommand(0x2c);

// writecommand(TFT_INVON); colstart = 1; rowstart = 26; }`

Boyeen commented 3 years ago

Sorry, I should have done this in Discussion.... my bad.