The pro version states it is 240x240, so not sure that 120x120 will work. I cannot see the resolution mentioned in the non pro advertising. I assume that the pro and non pro hardware use the same screen (noting meantime that assumption is the mother of screwups)
And then we come to this, from the esphome docs.
Note
Displays larger than the 135x240 pixel display on the TTGO T-Display shown require a significant amount of RAM to operate correctly. Some ESP devices, such as the ESP8266, do not have sufficient memory to support this display. If you attempt to use this component and experience repeated crashes, this is likely the cause of the issue.
I know the screen works with esp8266 in the author’s native c++ code, but maybe esphome is not memory efficient enough?
Has anyone got a pro to play with? (just ordered one, but ali being ali, it won’t be here for a while)
On memory-constrained devices, it may be possible to use part of the display area by specifying a smaller height and/or width than that of the actual display.
Finally got some progress today.
Comparing the SPI waveforms between the functional native firmware versus the EspHome generated, figured out the SCL line idle state was different…
Somehow CPOL:1 and CPHA:1 on the functional firmware (suspecting it could be related to the none usage of the CS pin).
Implementing a custom SPI setting in a custom st7789v component got the display behaving properly but still facing display size limitation probably due to not enough RAM in the ESP8266 and its implementation in ESPHome
Using 120x120 display is fine, but when trying with higher resolutions device has some spurious reboot suspecting memory leak or watchdog reset due to too long time spent in display update.
Still need to wok on it…
sharing my esphome fork with fixed st7789 component (st7789v_noCS branch) in case someone would like to investigate this also…
Yes the pro version and its ESP32 is easier and offers some extra features.
Though since I have a couple of those cheaper versions I am trying to get a software fix.
Definitely the ESPHome display component implementation is not suitable for ESP8266 with 240x240 screens since this display requires ~50kB of RAM usage for buffer that we cannot afford on this SOC.
So I have been starting to implement a version without frame buffer that makes the display refresh significantly slower but usable.
I am still working on it and I’ll share my branch later on, but I am now able to get the 240x240 display being functional with so far the limitation of getting the refresh rate being very slow (about 2.5s).
But I think that I can accommodate this for my usage and I am also expecting to improve this to be in the range of <1s.
For the ones still interested in using the st7789 with 240x240 display and ESPHome here’s my updated version that will make it compatible with :
Hardware not using CS pin (like the GEEKMAGIC Smart Weather Clock)
– If no cs_pin is declared the drivers will switch SPI to mode 3
ESP8266 and screen larger than 120x120
– The ESP8266 does not have enough RAM to implement frame buffer
– The implementation detects automatically if buffer ca be allocate (max 80% of heap) and deals with direct screen memory access instead without frame buffer allocation.
This implementation obviously adds some latency and the screen refresh being visible but still usable for most of my usage of this little unexpensive gadget with ESP home…
You’ll have to declare this external component version from my github fork
Yes the flickering is coming from the missing frame buffer…
Without frame buffer each time the display needs to be updated we have to load the entire screen memory with blank, then let the lambda update the screen memory with the content we want to display and write this content for each and every pixel in the memory screen.
The flickering is coming from the those 2 sequential write screen operations and the delay in between …
With frame buffer there is one single write operation to the screen…
To reduce flickering you can specify different ‘update_interval’ value (default is 5s) in the display configuration and/or request the update only on demand from another component with component.update: my_display or lambda 'lambda: ‘id(disp).update();’
Just received today a pro version. In case it could be useful, I performed some probing to identify the signals.
The programming connector has same assignment.
For tbe screen the signals are:
DC: gpio02
Sck: gpio18
Mosi: gpio23
Rst: gpio14
Backlight: gpio25
Cs is tight to gnd meaning we’ll have to SPI mode 3 as well to get it working.
Think the previously shared fork of the driver should work. I’ll give a trial tomorrow now…
The touch button is mapped on gpio32
[edit] Pins assignment confirmed as well as functionality with forked drivers. Since heap since is huge on ESP32, frame buffer is kept activated by default and no flickering effect…