-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ST7796 4.0" Display Support #1187
Comments
What exact display is it? Which touchscreen IC? I have a ST7796S and not ST7796 driver in the works...but it is not a 4" display either: https://github.com/richardklingler/esphome/blob/main/images/wt32-sc01_display.jpg |
Apologies - I closed the issue by mistake. |
I would really like to be able to utilize the WT32-SC01 units with ESPHome. Has this request simply been abandoned? I see the repo linked earlier on no longer exists... |
can't really help with WT32-SC01 (don't have one) but I do note that the other person commenting here does take sponsorships to publish devices... see their github https://github.com/richardklingler/esphome/ |
Now you got me looking though. Where did you get the 4" version from? I can't seem to find one. I've played a bit with ILI9341 displays in the past, and just a touch in ESPHome, but a 4" display could be a nice option - my go-to has always been the 240x320 2.8" displays as they seemed to be the right balance in screen realestate and resolution. Edit: found a couple on aliexpress. Will see if / when they arrive in AU and will take a look. |
all the code in esphome hard-codes the display sizes to 320x240 resolutions. This means at a minimum you would need to revise that to be able to use the extra screen pixels. I've asked on Discord, and I've got some hardware coming, perhaps once that arrives I'd be able to help test. |
What would be great is for anyone following along here and who has one of these 320x480 displays to thoroughly test out the ILI9341 2.4" option within esphome and report if, besides not being able to use the whole screen, everything else works as expected? This will test if it's just the screen resolution that needs adjusting (which uses more memory for the screen buffer - not a big deal on an ESP32 tho, but this will never work on an ESP8266, even the 240x320 doesn't). Hopefully it'll be suitably compatible with the ILI9341 code |
Hardware arrived. Can't repro the semi-working experience @dwaterford75 had - any chance you can dig out pins and setup that you tested this with? I've started looking at code. Any chance you can say how you got this display working? |
FYI: Similar issues as @dwaterford75 with a 2" ST7789V 240x320 display.
|
@Coolie1101 I think your problem has given me a slightly different angle on how to potentially address this request... There seems to be two significant barriers. First, the ST7789V code that is in esphome today seems to be fixed pixel dimensions (small !) so even if the driver worked for your display, it won't handle your resolution. Second, the ILI9341 code that kinda works on ST7789's (M5Stack option like you used above) is also at a fixed pixel dimension as well, 240x320, but doesn't handle all hardware specifics like mirroring the display like you need. To address this for 480x320 resolution screens (there is no supported option here at all at the moment) may need a massive change in structure so there's more screen size options for everyone. For you however it could be worth trying the edit in https://community.home-assistant.io/t/esphome-st7789v-modifications-to-use-a-240x320-pixel-screen/256347/10 that should be able to confirm if the ST7789V driver handles the setup of the screen better than the ILI9341 does by giving you correct colours and not mirrored display. The common 480x320 displays I found are also using an ST7789V like yours, so to properly support them needs thinking through how best to do that... I might kick that back to the actual esphome team to discuss. |
Hey @poundy, thanks for following up, your recommendation seems simple enough, but what exactly do I change in those files?, just the resolution? ** In .cpp File**
In .h file
RE: ILI9341, though not ideal, the colors I can work around, but if we had a flip option, that would take care of the mirror effect. |
I didn't look at the thread in much depth, but for a start I'd be looking at width and height params and seeing how they're used. More than that, and it becomes a somewhat-developer-delve-and-solve problem and I don't know how comfortable you are going deep... but hey, can't hurt either ;-) I think you're right in that it'll be necessary to change the resolution where you note, but without looking at the code I don't know what the X/Y offset values are for or how they have to change. I saw this update just as I was pinging the #dev channel on discord. Will see what they think and I'll post the link to that discussion once complete Edit: thread in Discord. https://discord.com/channels/429907082951524364/960438726067114024 |
So, I tried adding the edited files to "custom_components/st7789v/", but Esphome shows an error "Platform not found: 'display.st7789v' when configured, once I rename the "st7789v" directory to something else, the error goes away. Changes made:
In .cpp file Line 268-274
|
Try now esphome/esphome#3651 |
I just tried to get my WT32-SC01 display which is 480x320 using ST7796S to work using the updated ST7789V driver which supports higher resolutions. At first it would compile but then give "unable to allocate buffer errors" until I changed the "board" to one with 16mb and the PSRAM that this board has:
It boots without errors now, but I am getting nothing but a blank white display on the LCD. Then I tried it using the ili9341 display driver, and it actually displays text etc - and actually upright in the correct orientation, but not covering the whole display etc.
So this is promising at least ;) it appears that this ili9341 driver will just need to be updated to support other resolutions similar to how the ST7789V driver was and then the WT32-SC01 will be supported, then would just need the FT6336U capacitive touch chip too ideally, but I was more interested in just displaying data vs user input... |
Hi All, |
@dwaterford75 no I haven't tested anything. From your comment above, it seems the WT32-SC01's controller chip most closely matches the ili9341 and I'd agree that's the most promising area to pursue, but in my initial reviews it was beyond my programming ability to appropriately refactor it to suit. The delta report for this pull request however might shed more light on the form of the change, that might make it simpler for me to follow the bouncing ball and get it to work... |
It works!! The actual changes are not complicated though... Basically just replacing 320 with 480 and 240 with 320 throughout the source and then the init stuff was replaced with the init parts from here. It seems that the original ili9341 implementation was based on the Adafruit display library, at first I tried converting values from the eSPI library but it was not successful for unknown reasons, that attempt is still commented out in my hack.
|
@gpambrozio Great! yup that looks like what I would have done if I had more time! glad you got it refactored properly. Cheers |
Now we just need the FT6336U touch IC driver ;) |
@clowrey still a draft but if you want to test it and report back I'd appreciate it: esphome/esphome#3865 |
@gpambrozio awesome! I'll be away from computer for a few more days but will try it out when I can! Looking forward to that, this will complete being able to use these capacitive LCDs for info + control displays in ESPhome |
My display code was now added to esphome/esphome#3795 so I closed my pr. |
Thanks for this! I see you mentioned support of PSRAM, is this my issue? |
@shahargross85 most likely. ili9xxx will report of you have PSRAM or not. |
I'm using this configuration: esp32: Which ESP do you recommend to work with which support 320x480 screen resolution? See the logs below. I don't see any information about PSRAM: [09:10:09][I][app:102]: ESPHome version 2023.2.0-dev compiled on Feb 25 2023, 23:50:07 |
You could try to add |
Thanks. Sadly no PSRAM (or am I not enabling it?): which board ESP should I use for such an application? |
You can check this list and find a module here: https://www.espressif.com/en/products/modules |
this issue is finally solved in the last updated of ESP HOME |
Did you make it work without PSRAM? If not, which board did you get? I ordered a few 3.5 480x320 screens and wanted to make sure I don't need new esp32 boards |
Hi, No, I had to use a ESP with an external PSRAM, otherwise the device crashed as it didn't have enough memory |
@clowrey If I use ili9341 then it moans that it's been renamed but just get a flashing black and white full screen on boot, then nothing on my WT32-SC01 If I follow the suggestion to use ili9xxx then I do get output, but only on approximately 70% of the display |
[C][spi:023]: Setting up SPI bus... Core 1 register dump: Backtrace:0x400894b9:0x3ffb26600x400d8a09:0x3ffb2670 0x400d8a43:0x3ffb2690 0x400decf6:0x3ffb26b0 0x4016bf61:0x3ffb2700 0x400de934:0x3ffb2720 0x400e00a6:0x3ffb2750 0x400ebc3e:0x3ffb2820 |
adding psram: resolved the issue |
Describe the problem you have/What new integration you would like
So I have a 4.0" TFT Touch Display based on the ST7796 Driver which supports touch and runs on the SPI bus.
Is there any way to get support for this device in ESPHome?
Please describe your use case for this integration and alternatives you've tried:
I have tried the ILI9341 display configuration for this device and I get information on the screen but the size is wrong and it doesn't fill the whole screen. If I put a 2.4" ILI9341 device on, its perfect but I want a bigger display.
Additional context
The text was updated successfully, but these errors were encountered: