LCD tft screen inverted colours

I have just replaced my 0.9" 160x80 LCD screen and all colours/black and white are now inversed.
AFAIK it's the same type of screen, looks identical.
Some searching here suggests there's a way to invert the colours, but I don't know how to go about it.
I'll try to include code etc when asked.
Thanks
Dave

I think you need to include photo of you problem too, it will be much easier yo help you

OK, it's asked.
(Next time, assume people will ask it and include it right away.)

Also please share details of the display such as photos of both units and links to product pages. Are these color or B&W displays?

Link to display: 0.96'' Inch 80x160 IPS Full Color TFT LCD Display Module ST7735 SPI for Arduino | eBay

As for code, I didn't write it, it's a pretty large program (running on a ESP32 board), so I'll try to include what I think is helpful..
Firstly, from the sketch's "Dashboard" tab:

#include <Arduino.h>

/* DASHBOARD SETTINGS ************************************************************************************************
 *
 * for the Dashboard by Gamadril :https://github.com/Gamadril/Rc_Engine_Sound_ESP32
 *
 * Before you can use it (not required, if Visual Studio Code is used instead of Arduino, see platformio.ini in this case):
 * create the folder TFT_eSPI_Setups inside your Arduino TFT_eSPI library directory
 * move/copy the file Setup43_ST7735_ESP32_80x160.h to TFT_eSPI_Setups directory
 * replace the line #include <User_Setup.h> in the file User_Setup_Select.h inside TFT_eSPI library folder with #include <TFT_eSPI_Setups/Setup43_ST7735_ESP32_80x160.h>
 * modify the Setup43_ST7735_ESP32_80x160.h file if you use other pins for the display connection
 */

#define SPI_DASHBOARD // A 0.96" SPI LCD is used as dashboard: https://www.ebay.ch/itm/174458054566?hash=item289e82a7a6:g:LpAAAOSwtL1fdDtI
/* WARNING:
 * Pins 18 (SCL), 19 (DC), 21 (RES) & 23 (SDA) are used for the dashboard in this case!
 * The dispay CS pin needs to be connected to GND.
 * Shaker, sidelights and both beacon flashers will not work!
 */

uint8_t dashRotation = 1; // 3 = normal, 1 = upside down


#define MAX_REAL_SPEED 110                 // max speed in km/h to show on the dashboard
int manualGearRatios[3] = {305, 165, 100}; // TAMIYA gear ratios: 1st 1:32.49, 2nd 1:17.66, 3rd 1:10.66, value div 100 (used for real shifting transmissions only!)
#define RPM_MAX 500                        // always 500

Part of the main code:

#if defined SPI_DASHBOARD
  // Dashboard setup
  Serial.printf("SPI_DASHBOARD enabled. Pins 18 (sidelights), 19 (beacon2), 21 (beacon1), 23 (shaker) not usable!\n");
  Serial.printf("-------------------------------------\n");
  dashboard.init(dashRotation);
#endif

There's several other .h and .cpp files in the github thing eg

, sorry it gets beyond my simple program manipulation knowledge.

What I can't fathom is the previous display was fine (but failed as my VCC probably went too high) whereas this identical looking screen is colour inverted.
Should look like this:

but new display shows white as black, green as red, blue as yellow etc ie all are opposite to what they should be.

1 Like

OK, start by creating a new sketch that only writes something like "Hello world" onto the display. Once you've figured this out, in all likelihood you've learned enough to troubleshoot the present problem.

I'm afraid that's not going to be a very effective way of troubleshooting the problem. Moore's Law dictates that the solution is hiding in the parts you didn't share...

If I were to hazard a guess, you could try to uncomment the GREENTAB line instead of the REDTAB one. I have a feeling this might give some insight (and if you're very lucky, even solve the issue).

The root cause of the problem is likely a small difference in how the display memory is mapped between your old screen and the new one. Telling the sketch to use the correct code for your new display should solve the issue.

Thanks for your comments and suggestions.
Tried using the various "Greentab", "Redtab" etc options but no change.

I did come across another similar (old) thread with this issue, and this command was suggested:

I added the line tft.invertDisplay(1); from that post, however it needed an underscore prior to make it work.

It's added here in "dashboard.cpp" at line 16:

/*
 * dashboard.cpp - Library to drive a 80x160px color LCD as rc truck dashboard
 *
 * https://github.com/Gamadril/ESP32_LASE
 * MIT License
 */

#include "dashboard.h"
#include <TFT_eSPI.h>

Dashboard::Dashboard() {}

void Dashboard::init(uint8_t value)
{
    _tft.init();
    _tft.invertDisplay(1); // Dave mod to try invert display pixel colours, 0 = normal, 1 = inverted SUCCESS!
    _tft.setRotation(value); // 3 = normal, 1 = upside down
    _tft.fillScreen(TFT_BLACK);
    drawFrame();
    setSpeed(0);
    setRPM(0);
    setFuelLevel(0);
    setAdBlueLevel(0);
   
}



It has inversed all pixel colours and the screen now looks as it should, black screen with white or (correctly) coloured graphics.
Thanks to all that commented here, hope this helps others out.

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