nopnop2002 / esp-idf-st7789

ST7789 Driver for esp-idf
MIT License
234 stars 56 forks source link

Slow Refresh Rate of ST7789 Screen Compared to ESP-IDF Screen Library #34

Closed nikhil-robinson closed 1 year ago

nikhil-robinson commented 1 year ago

I've been using the ESP-IDF-ST7789 library for my project, and while I love the rendering capabilities of the GFX, I have noticed that the refresh rate of the ST7789 screen is significantly slower compared to the screen library of the ESP-IDF.

I believe that this issue could potentially hinder the performance of certain projects that rely heavily on fast refresh rates. It would be great if there could be some improvements made to the library to enhance the refresh rate of the ST7789 screen and bring it closer to the performance of the ESP-IDF screen library.

Thank you for your hard work on this library, and I look forward to seeing how this issue can be addressed.

nopnop2002 commented 1 year ago

I have noticed that the refresh rate of the ST7789 screen is significantly slower compared to the screen library of the ESP-IDF.

I don't know the screen library of the ESP-IDF. teach me please.

nikhil-robinson commented 1 year ago

screen library : https://github.com/espressif/esp-iot-solution/tree/master/examples/screen

ESP-IDF LCD driver : https://github.com/espressif/esp-idf/tree/56123c52aa/examples/peripherals/lcd/tjpgd

both f theses are very fast regarding decoding and displaying frames for st7789. but what they are lacking is the drawing capabilities which this project has

nopnop2002 commented 1 year ago

thank you

we'll look into these.

nopnop2002 commented 1 year ago

i read this: screen library : https://github.com/espressif/esp-iot-solution/tree/master/examples/screen

This app supports the following hardware esp32-devkitc-v4:No TFT esp32-lcdkit:No TFT esp32-m5stack:ILI9341 esp32-meshkit-sense:No TFT esp32s2-saola-1:No TFT

Does this app support ST7789?

nopnop2002 commented 1 year ago

I found the difference between the ESP-IDF LCD driver and mine.

ESP-IDF LCD driver : https://github.com/espressif/esp-idf/tree/56123c52aa/examples/peripherals/lcd/tjpgd

The ESP-IDF LCD driver always draws full pixel. Redraws every pixel on the screen, even if only one pixel wants to update.

For example, for a 240x240 TFT, one SPI transfer transfers 240x240=57600 pixels of data.

If you want to display HELLO on the screen, the ESP-IDF LCD driver will update 57600 pixels, while my driver will update [character width character height 5] pixels. For 32 dot font, 32*32*5=5125Pixels,

If you want to display a 10x10 square on the screen, the ESP-IDF LCD driver does 57600 pixel updates, but my driver does only [10+10+10+10] pixel updates.

If you want to display a single line on the screen, the ESP-IDF LCD driver updates 57600 pixels, but my driver only updates 240 pixels.

If you want to fill the entire screen with an image, the ESP-IDF LCD driver updates 57600 pixels once, but my driver updates 240 pixels 240 times.

The difference is clear.

The ESP-IDF LCD driver requires a memory area of ​​57600 pixels. The memory area for 57600 pixels is 57600*2 bytes --> 115.2KBytes. ESP32-C3 with 272KB of SRAM and ESP32-H2 with 320KB of SRAM are memory that is a heavy burden.

ESP-IDF LCD driver is fast when displaying an image on the entire screen, but very slow when displaying text or graphics on a portion of the screen. Also, ESP32-C3 and ESP32-H2 are at risk of memory overflow.

With my library, to display text or graphics, you just draw the pixels you need.

Please use properly according to your purpose.