ESP32 TFT display library

rolobr
Posts: 7
Joined: Thu Feb 15, 2018 3:49 pm

Re: ESP32 TFT display library

Postby rolobr » Wed Feb 21, 2018 4:34 pm

Hi,
thank you very much for the great library!

I got two small questions.

First I have problems using the function TFT_clearStringRect.

If I just enter the X- and Y-values of a string, then it is not erased correctly.
I have to use the Y-value minus fontHeight -3 to fix this.
I guess I make something wrong.
How do I use this function properly?

The second question is, how can I display the degree symbol °.
This I also tried in the example below.

Thank you very much :-)

Code: Select all

void printData(void *pvParameter) 
{

	font_transparent = 1;
	_bg = TFT_BLACK;
	_fg= TFT_WHITE;
	TFT_fillScreen(_bg);
	TFT_setFont(DEJAVU18_FONT, NULL);

	int xPosTempStr = 50;
	int yPosTempStr = 100;

	int fontHeight = TFT_getfontheight();


while(1) {

		float temperature = 25.00;
		char temperature_str[100];

		sprintf(temperature_str, "Temp.: %.1f %cC",temperature, (char)248);

		TFT_clearStringRect(xPosTempStr, yPosTempStr - fontHeight - 3, temperature_str);
		TFT_print(temperature_str, xPosTempStr, yPosTempStr);

		vTaskDelay(5000 / portTICK_RATE_MS);
	}

}

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

Re: ESP32 TFT display library

Postby loboris » Thu Feb 22, 2018 12:08 pm

@rolobr

I'm working on a major update or that library, I'll check the TFT_clearStringRect issue. The update should be ready in a couple of weeks.

I don't think any of the included fonts has a degree symbol (they have only 32 - 127 characters).
You can create your own font from tft font which will contain the degree symbol using the provided ttf2c_vc2003.exe
To convert 256 characters from tft font use:

Code: Select all

ttf2c_vc2003.exe 18 myfont.ttf myfont.c 32 256
The degree symbol will probably be ascii character 0xB0

You can delete unneeded symbols from the c file.

rolobr
Posts: 7
Joined: Thu Feb 15, 2018 3:49 pm

Re: ESP32 TFT display library

Postby rolobr » Thu Feb 22, 2018 1:52 pm

@loboris:

I discovered that in another function the following function was called to create a header:

Code: Select all

 TFT_setclipwin(0,TFT_getfontheight()+9, _width-1, _height-TFT_getfontheight()-10);
If I do not use this then the TFT_clearStringRect works as supposed to :-)

The creation of a font I will try.

Thanks again for the great library!

AAAwen
Posts: 15
Joined: Fri Sep 08, 2017 6:00 am

Re: ESP32 TFT display library

Postby AAAwen » Thu Mar 01, 2018 8:28 am

Dear all:

How to display Chinese on the LCD?

How to store the Chinese font into flash?

Thank you!

fanhuanji
Posts: 4
Joined: Tue Feb 13, 2018 6:55 am

Re: ESP32 TFT display library

Postby fanhuanji » Mon Mar 05, 2018 2:29 pm

AAAwen wrote:Dear all:

How to display Chinese on the LCD?

How to store the Chinese font into flash?

Thank you!
you can treat that Chinese character as a bitmap(1bit/pixel), like this, search HZK16 or “LED 点阵字库” and you may find "https://blog.twofei.com/embedded/hzk.html", wish this may help U. :)
把中文生成点整字库,色深一位的,像这个16*16的汉字占用16*16/8字节,整个gb2312常用汉字大概不会占用太大空间,你可以搜索HZK16(或者其他数字HZK24\HZK32\HZK40\HZK48),给你个连接https://blog.twofei.com/embedded/hzk.html ,我现在就在用这些字库,里面有好几个字号和字体,当然你也可以自己生成字库(简单方便的可能有工具软件,复杂点的试试自己写python或者其他什么语言来做字库),虽然嵌入这个不太好看,但这样用字库我很喜欢,希望能帮到你

\x10\x80\x10\x88\x24\x98\x44\xA0\xFE\xC0\x02\x84\x7C\x84\x44\x7C\x7C\x00\x44\x88\x44\x98\x7C\xA0\x44\xC0\x44\x82\x54\x82\x48\x7E
○○○●○○○○●○○○○○○○
○○○●○○○○●○○○●○○○
○○●○○●○○●○○●●○○○
○●○○○●○○●○●○○○○○
●●●●●●●○●●○○○○○○
○○○○○○●○●○○○○●○○
○●●●●●○○●○○○○●○○
○●○○○●○○○●●●●●○○
○●●●●●○○○○○○○○○○
○●○○○●○○●○○○●○○○
○●○○○●○○●○○●●○○○
○●●●●●○○●○●○○○○○
○●○○○●○○●●○○○○○○
○●○○○●○○●○○○○○●○
○●○●○●○○●○○○○○●○
○●○○●○○○○●●●●●●○
○○○○○○○○
○○○○○○○○
○○●●●●○○
○●●○○●●○
●●○○○○●○
●●○○○○○○
●●○○○○○○
●●○●●●●○
●●○○○●●○
●●○○○●●○
○●●○○●●○
○○●●●○●○
○○○○○○○○
○○○○○○○○
○○○○○○○○
○○○○○○○○

fanhuanji
Posts: 4
Joined: Tue Feb 13, 2018 6:55 am

Re: ESP32 TFT display library

Postby fanhuanji » Mon Mar 05, 2018 2:37 pm

AAAwen wrote:Dear all:

How to display Chinese on the LCD?

How to store the Chinese font into flash?

Thank you!
oh, for the storage, you can refer to "esp-idf\examples\wifi\wpa2_enterprise\main\" in component.mk wpa2_enterprise_main.c, there shows a way to include binary files into the program binary, in that project it includes that enterprise key into the program.
看看 esp-idf\examples\wifi\wpa2_enterprise\main 目录里面的那个mk和c,里面有怎样把企业版wpa2的证书嵌入到程序中的方法,这是一个方案,
另一个方案是(也是我正在用的),写程序,将二进制文件转化成一个头文件,然后inclue那个头文件即可

AAAwen
Posts: 15
Joined: Fri Sep 08, 2017 6:00 am

Re: ESP32 TFT display library

Postby AAAwen » Wed Mar 21, 2018 8:36 am

@fanhuanji
Thank you! It's very nice of you.

Masi2018
Posts: 2
Joined: Tue Jan 16, 2018 7:05 am

Re: ESP32 TFT display library

Postby Masi2018 » Wed Mar 28, 2018 7:28 pm

Hi All
I was wondering if ILI9488 can work in 16bit ( 2 byte per color pixel) or just 24bit (RGB888) color in 4 wire SPI mode is available? Since according to datasheet it supports 65k color mode in SPI 4 line interface but I couldn't run that in 16bit.
Thanks in advance

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

Re: ESP32 TFT display library

Postby Vader_Mester » Sat Mar 31, 2018 10:47 am

Masi2018 wrote:Hi All
I was wondering if ILI9488 can work in 16bit ( 2 byte per color pixel) or just 24bit (RGB888) color in 4 wire SPI mode is available? Since according to datasheet it supports 65k color mode in SPI 4 line interface but I couldn't run that in 16bit.
Thanks in advance
The ILI4988 is actually 16bit color. Even if you send color in 24 bit mode, it will ignore the lower 3bits of red and blue and the lower 2bits of green.
It is in the datasheet, but don't remember where exactly.
There are 2 types of programmer people: The Expert programmer and The Smart programmer

The Expert programmer easily writes any code from scratch.
The Smart programmer uses his google/github powers first ;)

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

Re: ESP32 TFT display library

Postby loboris » Sat Mar 31, 2018 12:33 pm

Vader_Mester wrote:The ILI4988 is actually 16bit color. Even if you send color in 24 bit mode, it will ignore the lower 3bits of red and blue and the lower 2bits of green.
It is in the datasheet, but don't remember where exactly.
This is not true.

Look at Data sheet page 122.

Image

ILI9488 in SPI mode supports 3-bit/pixel - 8 color (page 120) and 18-bit/pixel - 262K-color (page 122).

When 24-bit mode (RGB888) is used, 24 bits are sent, but two least significant bits of each color component are ignored (so it is actually RGB666).

Who is online

Users browsing this forum: No registered users and 3 guests