ESPHOME ST7789v modifications to use a 240x320 pixel screen?

Hello,

i have a 240x320 pixel IPS screen and when i use the example in EspHome, my image just use the hardcode 135x240 pixel like the TTgo screen.

Is there a way to specify the size of the screen in Esphome, platform st7789v please?

i see TFT_HEIGHT and TFT_WIDTH but i dont know if i can and how can i use it?

Thanks

Same problem here but even worst it shows like the bellow.

There already exists an ESPHome issue for this:

You could add your findings there. That will also help to not let it auto close.

I have no idea how the st7789v works. But in the code of esphome (st7789v.cpp) there are some hardcoded offsets. (method “write_display_data” line 137 - 140) and the “get_width_internal” and “get_height_internal” return hardcoded resolution values.

If I were in your situation I would play around with those values.

1 Like

You could try:


  uint16_t x1 = 0;   // _offsetx
  uint16_t x2 = 239;  // _offsetx
  uint16_t y1 = 0;   // _offsety
  uint16_t y2 = 321;  // _offsety
int ST7789V::get_height_internal() {
  return 320;
}

int ST7789V::get_width_internal() {
  return 240;
}

Tried it but did not seem to work

Does it still log the wrong resolution in the log output even with those changes?

Yes the same wrong resolution.
But i believe i am changing it in the wrong place. I have the addon of esphome (docker installation)
And i made the change under \config\esphome\project name

Yes very likely it got overwriten when you rebuild the firmware (if you open the file again it will be the original file again).

I don’t know where the esphome addon stores its source code. Normaly you are not supposed to edit that. But for a quick test to see if that fixes the issue (then you can provide that info into the issue in github and some dev may fix it) I think it is OK.

Grab the ST7789v source code from Github (see below), and copy it to a folder beneath Home Assistant’s esphome directory named custom_components/st7789v/. Then edit the CPP and H source files there; they will be used to compile, and they will not be overwritten.

https://esphome.io/api/dir_b2210092d2d495a0f63f571914756838.html

You should probably also get the files

__init__.py
display.py

from here:

and place them in the same folder.

Hi, Somebody found a solution ?

Hello,

i give up month ago, because i have made what @FredTheFrog tell to do at first but without any luck…post here after to ask…nothing more found about those screens…

i just stay on my ILI9341 320x240 3.2", its cheap and reliable.