ESP32 TFT display library

kearins
Posts: 21
Joined: Sun Jul 23, 2017 11:48 pm

Re: ESP32 TFT display library

Postby kearins » Wed Sep 27, 2017 8:40 am

loboris wrote:I have the fix for that issue ready, it will be pushed today or tomorrow.
Good news, and so fast.
In addition,
1) could you please change deprecated esp_heap_alloc_caps.h to esp_heap_caps.h and pvPortMallocCaps() to heap_caps_malloc()?
2) While experimenting with the TFT library I stumbled with esp32 hangs when the size parameter for heap_caps_malloc() was not 4-bytes aligned, so I modified the code to pass aligned parameter to all heap_caps_malloc() calls:

Code: Select all

size = (size + 3) & (~3);
Please pay attention on it.
3) In tft.h in section 'Global variables' variables should have 'extern' because it's declaration only, varialbles are really defined in tft.c
So in tftspi.h:

Code: Select all

extern uint8_t gray_scale;
etc...

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: ESP32 TFT display library

Postby loboris » Wed Sep 27, 2017 9:12 am

@kearins
Yes, I've changed esp_heap_alloc_caps.h to esp_heap_caps.h.
Thanks for the extern warning...

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: ESP32 TFT display library

Postby loboris » Thu Sep 28, 2017 10:48 am

Update:
  • The latest esp-idf master branch is now supported
  • Added support for ST7735 (128x160) based displays
  • Some minor bugfixes

kearins
Posts: 21
Joined: Sun Jul 23, 2017 11:48 pm

Re: ESP32 TFT display library

Postby kearins » Thu Sep 28, 2017 1:39 pm

I tested under latest esp-idf version with TFT ST7735 and it works fine. I added an issue to report minor changes on https://github.com/loboris/ESP32_TFT_library to compile with c++ projects. Thank you.

JanJansen47
Posts: 27
Joined: Sun Jan 01, 2017 9:21 pm

Re: ESP32 TFT display library => 3.5" 320x480 ILI9844

Postby JanJansen47 » Mon Nov 20, 2017 4:32 pm

Hi Loboris,

After using the "first" TFT display library since several months I want to switch to the latest version.
Settings:
- using the latest esp-idf
- the correct commit
- same display / pinout
- same type of display and resolution
- correct setting of menuconfig
- No compilation issues

After flashing:
SPI: TFT display DEMO LoBo 11/2017
SPI: Pins used: miso=19, mosi=23, sck=18, cs=5 => is correct
SPI: display device added to spi bus(1) => should be 2??
SPI: display init ...
OK
SPI :max rd speed = 800000
SPI: Changed speed to 4000000

After some lines:
Display: ILI9844 : PORTRAIT 320,480 Color

What shows the display:
The display shows a black flash concentrating in one horizontal line. After the flash the display is white. And yes is runs the sequence and you can see something happens in the background on the display.
I assume the display is added to the wrong bus? Any idea whats going wrong?

Earlier version:
After loading the first library the display works as usual! ( only after a reset of the display)
Jan Jansen
Amsterdam
The Netherlands

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: ESP32 TFT display library

Postby loboris » Wed Nov 22, 2017 7:51 pm

Everything should work with the updated library the same as with the old one.

The display cannot be added to the "wrong bus". The bus used is defined at the begining of the tft_demo.c. The default bus is now 1 (HSPI), maybe it was 2 before, but it should not affect the operation.

Please check all settings at the begining of app_main and in the tftspi.h.
After the flash the display is white
Probably the spi speed is too high, Try to set i to 26MHz (spi_lobo_set_speed(spi, 26000000); in tft_demo.c).

JanJansen47
Posts: 27
Joined: Sun Jan 01, 2017 9:21 pm

Re: ESP32 TFT display library

Postby JanJansen47 » Thu Nov 23, 2017 12:09 pm

Thx,

For the hint, my settings were okay however: decreasing the SPI speed was the solution for the issue. I will measure the SPI speed (first and now) later and see where the difference is.
Jan Jansen
Amsterdam
The Netherlands

JanJansen47
Posts: 27
Joined: Sun Jan 01, 2017 9:21 pm

Re: ESP32 TFT display library

Postby JanJansen47 » Thu Nov 23, 2017 2:50 pm

Unfortunately my logic analyzer does not measure accurately up to these speeds.
So by trial and error I found that 32MHz instead of the 40MHz (first release) works reliable for this ER-TFTM035-6 display.

Thx for your help
Jan Jansen
Amsterdam
The Netherlands

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: ESP32 TFT display library

Postby Vader_Mester » Fri Dec 08, 2017 8:59 am

Hi @Loboris,

I'm planning to buy some stuff (LCD screen, etc) for my new home project, and planning to implement your library.

I just have a couple of questions:
- Does your code support transparency, for example in BMP images? I wish to have icons with round corners, that can fit on any background without "residue" background pixels the the rounded corners. I know I BMP format supports this, but I'm unsure about your code.
- I'm planning to experiment with the capacitive touch. For me it looks like no problem, since the FT6236 just uses I2C and several nice signals such as Interrupt on touch event (very handy, when I detect a touch to turn on screen or screen backlight).

- I'm planning to use an ER-TFTM035-6. I've seen in the datasheet of ILI9488 that it supports sleep mode and deep standvy, but it's not quite clear what's going on on the screen while in sleep or deep standby. My question is, that in your code, is there a way to put the screen in sleep, and what happens when you do so? I'M planning to put this thing on the wall to controll stuff in my home, but when I'm actually not using the device, I not only want to dim down the screen but also turn it off, so it's displaying nothing, in order to prevent the Burn-in and ghosting effects. (And of course when you touch it it wakes up, and make it ready for use).

Thanks for your answers in advance!
Vader

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

kearins
Posts: 21
Joined: Sun Jul 23, 2017 11:48 pm

Re: ESP32 TFT display library

Postby kearins » Sat Dec 09, 2017 5:55 am

Hi @Vader
As far as I know, the library supports only 24-bit BMPs, so BMP with alpha-channel will be ignored:

Code: Select all

	memcpy(&wtemp, buf+28, 2);				// the number of bits per pixel
	if (wtemp != 24) {err=-8; goto exit;}
It's interesting to hear from @loboris about plans on image transparency.

To put ILI9488 in sleep mode you should send 0x10 command to display using public library function:

Code: Select all

void disp_spi_transfer_cmd(int8_t cmd);
The screen will store a state during sleep mode and there is no need to redraw it after sleeping out. For sleep out send 0x11 command with the same function disp_spi_transfer_cmd().

Are you sure sleep mode is a good idea? For me, it is more comfortable to have a screen always on:
1) to always see house components' condition,
2) to have an ability of one-push action for usefull functoins.
Instead of sleep mode I prefer to have a light sensor to control brightness level during day/night. At least sleep mode can be managed over configuration as a feature. Or it can be movement sensor to wake up the device.

Who is online

Users browsing this forum: No registered users and 43 guests