esphome / issues

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

Alerting the st7789v component - copying to custom_components #2672

Open scargill opened 2 years ago

scargill commented 2 years ago

The problem

I've a problem (I'm not alone) with the ST7789v component - NOT using a TTGO display but a full 320*240 version. The CPP and H files sit in esphome/myproject/ src/esphome/components/st7789v folder but of course you can't alter that. SO I tried copying that folder into esphome/custom_components/ folder and without ANY mods the compilation fails. This is in Windows not Linux so I'm not expecting permissions issues. If I BIN the new folder, compilation works again.

I THINK the answer for the ST7789v is to change width and height variables starting at line 222, but I simply cannot find a way to alter the source file.

Which version of ESPHome has the issue?

2021.9.1

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

2021.9.1

What platform are you using?

ESP32

Board

nodemcu-32s

Component causing the issue

st7789v

Example YAML snippet

The issue is making a change as above - I'm sure the change will fix the issue (or one of them - the colours are also reversed on a standard 320*240 st7789v display compared to TTGO) but I'm not able to change the source. HELP.

Anything in the logs that might be useful for us?

I simply get a compile failure -   Platform not found: 'display.st7789v'.

Additional information

No response

OttoWinter commented 2 years ago

You need to copy the folder from https://github.com/esphome/esphome/tree/dev/esphome/components/st7789v. The code in the generated project only contains the generated h/cpp source files, not the python files that validate/generate the code.

scargill commented 2 years ago

I did that last night and thank you very much - that compiled properly - sadly it did not run properly if changes were made. I changed offsets and instead of a centred TTGO display I got my box top right (no idea why not top left) - BUT when I changed the width and height - all I got out was a white flashing screen instead of my original display. See image - the original code was intended for the TTGO display which is 240135 instead of the more normal 320240. 2021-11-03 14_18_28-Your Phone

scargill commented 2 years ago

So, with the full folder as advised in custom_components - I can move that display up and right.... by altering st7789v.cpp and re-compiling and running - no problem..

Starting at line 136:

void ST7789V::write_display_data() { uint16_t x1 = 52; // _offsetx uint16_t x2 = 186; // _offsetx uint16_t y1 = 40; // _offsety uint16_t y2 = 279; // _offsety

Simply change x1 offset to 0 and reduce x2 offset accordingly - y1 offset to 0 and y2 offset accordingly - creates the same display on TOP RIGHT... (top left would be better of course... BUT starting at line 222:

int ST7789V::get_height_internal() { return 240; // 320; }

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

If I change the first function to 320 as indicated in the comments - and and function to 240 as indicated, no matter what I do with the previous offsete - I get a white screen flashing on and off - none of my lines or text appearing at all.

Any ideas as to what else might be needed? People have been asking about this in ESPhome for a year and I fell this is so near, but not near enough :-)

probot-esphome[bot] commented 2 years ago

Hey there @kbx81, mind taking a look at this issue as it has been labeled with an integration (st7789v) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

fraxinas commented 2 years ago

so i've worked on this in my personal branch https://github.com/fraxinas/esphome/tree/fix_st7789v because i have a 240x240 display.