I have noticed over multiple ESPHome projects that when I display an image on an LCD screen the device becomes very slow and sometimes unresponsive. I’ve seen this with JPG, PNG and BMP images even with low detail and bit depth. Typically my screens are using the SPI interface. The problem is more visible when using an “ESP32 S2 Mini” or one of the tiny “C3 Super Mini” devices but is still seen on a standard ESP32. The default screen refresh is every 1 second but you can set that as desired, for instance to every 10 seconds. However, for about 2 to 3 seconds when the refresh is happening the device still becomes slow and unresponsive.
You can set the refresh to “never” as seen below, however if you have other pages being displayed, either on a loop or selectable, then those pages also have no refresh, so if you are displaying sensor values, graphs, the time etc etc then those will not update.
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
display:
- platform: ili9xxx
model: ST7789V
id: my_display
reset_pin: GPIO33
cs_pin: GPIO5
dc_pin: GPIO26
color_palette: IMAGE_ADAPTIVE
color_palette_images:
- "images/monstera_deliciosa.png"
- "images/rgb-sample.jpg"
invert_colors: True
rotation: 270
update_interval: never
I’ve worked out a nice simple way of having a different screen refresh for the text based pages or graph pages that do need to refresh but while keeping the default refresh of “never” on the image based pages. In the example below pages 1 and 2 have sensor outputs being shown so do need to update regularly, and page 3 has a static image that takes a long time to draw and does not need to be refreshed.
interval:
- interval: 2sec
then:
- if:
any:
- display.is_displaying_page:
id: my_display
page_id: page1
- display.is_displaying_page:
id: my_display
page_id: page2
then:
- component.update: my_display
This seems to be a good solution for creating a dynamic refresh for different pages. You can change the interval value from 2s to what ever you wish and the pages you specify will refresh that often.