LILYGO TTGO T-Display Incredibly Slow?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
stanely
Posts: 55
Joined: Fri Jan 17, 2020 5:19 am
Location: Ohio, USA

LILYGO TTGO T-Display Incredibly Slow?

Post by stanely » Wed Feb 26, 2020 4:42 pm

I loaded the st7789py.py T-Display driver from, https://github.com/devbis/st7789py_mpy. Next I used Russ Hughes' (@russ_h), Hershey font demo from, https://github.com/russhughes/ttgo-hershey-fonts. I used the two in-memory fonts (romans.py & scritptc.py) which are supposed to be faster than the file fonts. (To make it work, you have to rename st7789py.py to st7789.py because that's what pyhello.py and pytext.py import. I also commented out the line, "'sys.path.append('/pyfonts')", because I put the two font files in the root directory.)

All was easy and everything worked after I saw the import error. However, the demo takes 6.57 seconds to fill the screen with 'Hello!' in the two fonts. That's 7 lines of 6 characters each. Almost a second per line! This does not seem reasonable.

Looking at Russ's C vs Py demo video, https://www.youtube.com/watch?v=vJM0UM0XSL4, I get nothing like his speed result in the right side of the demo. Mine is about as fast as I could write with a pencil.

After re-reading Russ's description of his YouTube speed comparison, I realized both panels use the C driver, but either file or memory based fonts. I think that explains what I'm seeing.

Is the ST7789 just a bad choice for a pure MicroPython system? Is the bad performance in the Python driver or the display? I'm also using the SSD1306. That display is lightning fast.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: LILYGO TTGO T-Display Incredibly Slow?

Post by jimmo » Thu Feb 27, 2020 3:51 am

It certainly is a bit of a tough case for Python -- one of the main reasons the ssd1306 driver is so fast is that everything happens in a framebuffer, which is mostly implemented in C, and then all you have is full-screen updates.

Do you have SPIRAM and enough room for a 240x240 framebuffer? Might be interesting to try rewriting the driver in the style of ssd1306.py and see how that goes? (You'd pretty much just remove most of the code and just use something similar to the blit_buffer method to write the framebuf to the display in one go).

User avatar
russ_h
Posts: 88
Joined: Thu Oct 03, 2019 2:26 am
Contact:

Re: LILYGO TTGO T-Display Incredibly Slow?

Post by russ_h » Sun Mar 01, 2020 6:58 am

The Hershey fonts are vector fonts so they are much slower to draw using the pure python driver. Bitmapped fonts are much quicker in python and even faster with the C driver. The https://github.com/russhughes/st7789_mpy repo has a firmware.bin I compiled using the MicroPython 1.12 source including the C driver and bitmap fonts. It works well with the TTGO T-Display.

If you need or want Hershey font support I can push out a version with it pretty easily.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: LILYGO TTGO T-Display Incredibly Slow?

Post by pythoncoder » Sun Mar 01, 2020 11:40 am

I must admit I'm puzzled by the recent emphasis on Hershey fonts which seem a poor match for microcontroller technology.
Peter Hinch
Index to my micropython libraries.

stanely
Posts: 55
Joined: Fri Jan 17, 2020 5:19 am
Location: Ohio, USA

Re: LILYGO TTGO T-Display Incredibly Slow?

Post by stanely » Sun Mar 01, 2020 1:03 pm

russ_h wrote:
Sun Mar 01, 2020 6:58 am
If you need or want Hershey font support I can push out a version with it pretty easily.
No, I can't really use the Hershey fonts. I was just evaluating the T-Display to see if it suits my project. Your code was the quickest path to installing and testing. I understand what you did with the turtleplotbot and why you used vector fonts. I didn't fully understand what was going on with generating the dots on the screen and why it was so slow. It's starting to make sense.

I'm actually using Peter's font-to-py for the fonts, and would ultimately want to use his Writer class. The main reason being that the LILYGO TTGO T-Display boards are dirt cheap. (Being cheap, it's lacking the the RF shield over the ESP32 chip. I'm concerned that getting an FCC sticker for it might be difficult or impossible.)

I didn't see a framebuf driver for the T-Display, and don't understand that well enough to write one. Without Writer class compatibility, this one is a dead end anyway.

Thanks for posting your code. I may yet find an application for the T-Display.

Post Reply