Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays

OK, so you need to add:

#define TFT_INVERSION_ON

to the setup file. This corrects the display black/white swap. The examples should then run with the correct colours.

If you see colours in images (jpegs etc) are wrong then you need to add:

tft.setSwapBytes(true);

to your sketch. This corrects for the endianess of the byte order.

Hello,
I`m also fight with same display. tft.invertDisplay(true) makes all examples work ok :slight_smile:
I need to change

#define SPI_FREQUENCY 20000000

to 10000000

and I think this is main homer2009 problem.

But drawJpeg from TFT_eFEX draw bad colors from jpeg :frowning: Colors are near the truth colors but not the same. Bright red is yellow, darker red is something like magna.

tft.setSwapBytes(true);

Thanks for the answer. Tomorrow I will check and let me know if the display works well

@bfksoql
It sounds like you have a different drive chip in your display and the colour settings loaded during init are not compatible with it. This is also indicated by the need for the inversion which is not necessary on my ILI9486 based display. Do the rotations look OK on the graphics test?

Hello Bodmer.An oath of examples(coulor_test)they work properly.
Example TFT_flash_jpg proceeds incorrectly.
Next it displays bad colors

As your display has a different colour setup try using:

tft.setSwapBytes(true);

and if that does not work try:

tft.setSwapBytes(false);

One of these lines may need to be added in setup() of each sketch if you are handling images in the sketch. This swaps the colour bytes.

  1. If the colours have been corrected by TFT_INVERSION_ON everything else should work.

  2. The JPEG programs should read the JPEG file in the byte order on disk and calculate the pixel colours.

  3. Since the pixel colours were fixed in (1), the JPEG image should be correct.

Most Arduino targets are little-endian
TFT controllers are big-endian.

If a "raw" image is dumped from TFT Graphics Memory it will read pixels as RGBRGBRGB... on most controllers.
Other controllers will read as 16-bit pixels (5-6-5 format) as HLHLHL... i.e. big-endian

The TFT_eSPI library will know what to do with any published image format like .BMP or .JPG

The byte-order problem will only arise with "RAW" byte dump images.
They might be stored in HLHL... order or in LHLH... order.
Hence you might need to use the setSwapBytes() feature

I do not own any "shift register style" displays.

David.

@bodmer I just found your Dark Sky library after searching for an OWM alternative.

I just wanted to say a big thanks for your work!! :slight_smile:

Also, I only have 128x128 TFT at the moment so have not used your TFT_eSPI library, but I have some larger displays on the way :slight_smile:

My appreciation to the excellent works of the Arduino masters such as david_prentice and others here and especially to Master Bodmer. I like a lot of images in tft display like this 'ESP8266_draw_565_image2' but, I also like scrolling text on display, so I wonder if Bodmer or anyone made available here some sketch for Arduino or espodel for text scrolling, vertical in color? Thank you all

General question related to do touch implementation:

I have some code that reads a physical switch which I want to change to a touch area. It's based on a state machine style coding. (Forgot to mention it's M5Stack-MultiApp-Advanced which display is using the TFT_eSPI driver)

I have an idea about the code but need some pointers if I am on the right track.
Somewhere along the line of this:

//define touchArea for button 1 
u_int 16 OnScreenBtnP.X = 100
u_int 16 OnScreenBtnP.X1 = 160
u_int16  OnScreenBtnP.Y = 80
u_int16  OnScreenBtnP.Y1 = 140

/*----------------------------------------------------------------------*
* read() returns the state of the on-screen touch button, 1==pressed, 0==released, missed etc.   *
*----------------------------------------------------------------------*/

uint8_t Button::read(void)
{
    
    if (touchController.isTouched(500) && millis() - lastTouchMillis > 1000) {
        TS_Point p = touchController.getPoint();
        lastTouchPoint = p;
        lastTouchMillis = millis();
        if (p.y = > OnScreenBtnP.Y and < OnScreenBtnP.Y1) {
          if (p.x = > OnScreenBtnP.X and < OnScreenBtnP.Y1) {
       _state = 1 // Consider virtual button button1 pressed
}       
 return _state;
    }
    else {
    
            _state = 0; //missed, released, not pressed or wrong area, consider state 0
        }
        return _state;
    }
}

}

@Dancopy: have a look at the "TFT_Terminal" example. Hardware based scrolling is available in portrait orientation only for full width of screen. For small scrolling areas see Sprite scroll examples.

@Mac_che: see "On_Off_Button" example.

How to interface 3.2" UTFT ILI9481 with NodeMCU ???? Kindly Help

Connection details are in the User_Setup.h file.

Taking advantage of the opportunity, I would like to suggest to Master Bodmer to adapt his 2 "Digital and Analog Clock" sketches from his old library with his current TFT_eSPI library to a 3.5" ILI9488 display with ESP32 or ESP8266; Thanks

Go on. There is already a TFT_Clock and TFT_Clock_Digital example for 320x240 and for 160x128.

Surely you can adjust the maths to suit 480x320 or any arbitrary shape or size screen.
Examples are designed to illustrate the methods, show possibilities and give you ideas.

David.

Thank you David, I'll try!
Although the example comes 'raw'; I'll have to use some RTC to get the time.

You can test the "look and feel" of a clock by using the Arduino internal system timer e.g. millis()

Replace this with an external RTC after you have the display looking like you want.

Explain in English what you want to do. e.g. clockface in different location, size, colours, or style.

Readers can only help you with coding when they know what you actually want.

David.

Hi all,

Quite new to Arduino. I think I have a NodeMCU ESP8266 board and a mcufrield.com 3.5" display.

If someone can help out with the connections between the two, it will be greatly appreciated. I am assuming the TFT-eSPI is the correct library but without proper connection, I am sure my display won't work.

Any help will be greatly appreciated.

GitHub - lualiliu/esp32-gameboy: ESP32 Gameboy emulation based on Arduino . Would be nice if we can port this project to make use of TFT_eSPI and thus bigger screens..

I have a touch LCD shield with parallel interface, a clone of this one (or at least extremely similar). How to properly wire it to ESP32 for use with this library? Just the screen, no touch or SD card for now.

This is what confuses me in the docs - this is an example config for ILI9341:

//#define TFT_MISO 19
//#define TFT_MOSI 23
//#define TFT_SCLK 18
//#define TFT_CS   15  // Chip select control pin
//#define TFT_DC    2  // Data Command control pin
//#define TFT_RST   4  // Reset pin (could connect to RST pin)
//#define TFT_RST  -1  // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST

My board also has 9341, but I have the following pins:
RST (this one is clear, just a Reset pin)
CS
RS (??)
WR (MOSI?)
RD (MISO?)
And 8 data pins.
No SCLK!