esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

Wrong Display Dimensions for ST7789 #3192

Closed Coolie1101 closed 2 years ago

Coolie1101 commented 2 years ago

The problem

Trying to use a ST7789 (240x320) display configured as ST7789V, but the display view size is being rendered as 135 x 240 pixels instead of 240 x 320 pixels.

Which version of ESPHome has the issue?

ESPHome version 2022.3.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32

Board

nodemcu-32s

Component causing the issue

No response

Example YAML snippet

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO19

display:
  - platform: st7789v
    rotation: 180
    backlight_pin: GPIO4
    cs_pin: GPIO5
    dc_pin: GPIO16
    reset_pin: GPIO23
    id: display1
    pages:
      - id: page0
        lambda: |-
          it.rectangle(0,  0, it.get_width(), it.get_height(), id(my_red));
          it.print(0, 0, id(font1), "Hello World!");

Anything in the logs that might be useful for us?

[07:44:53][C][st7789v:119]: SPI ST7789V
[07:44:53][C][st7789v:119]:   Rotations: 180 °
[07:44:53][C][st7789v:119]:   Dimensions: 135px x 240px
[07:44:53][C][st7789v:120]:   CS Pin: GPIO5
[07:44:53][C][st7789v:121]:   DC Pin: GPIO16
[07:44:53][C][st7789v:122]:   Reset Pin: GPIO23
[07:44:53][C][st7789v:123]:   B/L Pin: GPIO4
[07:44:53][C][st7789v:124]:   Update Interval: 5.0s

Additional information

image

image

Electronlibre2012 commented 2 years ago

hello @Coolie1101

i try few month ago to make it works with a 1.5" TFT with st7789v driver but its a lost of time ! (for me because my skill to rewrite the ST7789 Arduino library is bad lol) . the 135 x 240 pixels are hardcoded in the esphome library...only work with a TTGO T-Display module as shown in the beginning config page : https://www.esphome.io/components/display/st7789v.html?highlight=st7789

i use instead the st7735 esphome display...work nice...with a st7735 driver display of course... https://www.esphome.io/components/display/st7735.html?highlight=st7735

and my favorite is the ILI9341 : cheap, big (3.2" max) 320x240 pixels!

and a beautiful one is the SSD1351 https://www.esphome.io/components/display/ssd1351.html is a OLED display so very nice to display pictures but only 128x128 pixels...small

so..if you want to make it work with your display you have to make a custom_component st7789 in esphome folder in /config/ of ha and a lot of rewrite the arduino library st7789...

good luck!

Coolie1101 commented 2 years ago

@Electronlibre2012 Thanks for the info.

(for me because my skill to rewrite the ST7789 Arduino library is bad lol)

I'm even worst 🤣

and my favorite is the ILI9341

I did get this ILI9341, but it was too difficult to setup, as I think it wasn't the SPI version, I am going to try again with this SPI version, so many variables to be aware about, and not knowing what to look for has been a real challenge.

so..if you want to make it work with your display you have to make a custom_component

Too far fetch for me, I'll stick with the basics for now unless someone shares a config I can use.

Coolie1101 commented 2 years ago

I wish there was a simple flip option, as I have the ST7789 configured and working as a ILI9341, but the display is reverse.

Red and Blue is swapped, and text is mirrored (reverse), but I am able to utilize the entire display. Disregard the vertical line, it's from the screen protector.

image

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO19

display:
  - platform: ili9341
    model: M5STACK
    led_pin: GPIO4
    cs_pin: GPIO5
    dc_pin: GPIO16
    reset_pin: GPIO23
    id: display1
    pages:
      - id: page0
        lambda: |-
          it.rectangle(0,  0, 320, 240, id(green));
          it.rectangle(16, 16, 288, 208, id(red)); // display as blue
          it.rectangle(32, 32, 256, 176, id(yellow));
          it.rectangle(48, 48, 224, 144, id(blue)); //display as red
          it.rectangle(64, 64, 192, 112, id(gray));
          it.print(160, 100, id(font3), TextAlign::TOP_CENTER, "Hello World!");
          it.printf(160, 170, id(font0), TextAlign::BOTTOM_CENTER, "Powered By ESPHome on HassOS");
github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.