landonr / lilygo-tdisplays3-esphome

tdisplay s3 170x320 running esphome using patched tft_espi
88 stars 30 forks source link

Latest TFT_eSPI library and dimmable backlight #15

Open bradmck opened 1 year ago

bradmck commented 1 year ago

This isn't a bug, I just wanted to share some info. I was able to get this working using the latest TFT_eSPI library - using the older custom_component method vs. the newer external_components method for now. I was also able to setup the backlight pin with ledc so it's dimmable. These were very simple changes to just a couple of header files in the TFT_eSPI library:

In User_Setup_Select.h comment out this line:

#include <User_Setup.h>

And uncomment this line:

//#include <User_Setups/Setup206_LilyGo_T_Display_S3.h>

In User_Setups/Setup206_LilyGo_T_Display_S3.h comment out these two lines:

#define TFT_BL 38  
#define TFT_BACKLIGHT_ON HIGH

Then in your ESPHome yaml file use this for the light - get rid of the GPIO switch and replace with this:

output:
  - platform: ledc
    pin: GPIO38
    id: gpio38
    frequency: 10000

light:
  - platform: monochromatic
    output: gpio38
    name: "Backlight"
clowrey commented 1 year ago

@bradmck For me all I care about is having the ability to use print statements + simple lines in the lambda.

Other stuff could slowly be added later I'm sure.. Maybe you could make a short writeup summary of how this current repository here accomplishes what it does with eSPI? And how the Lovayn library would be different/similar? I know the code is there but I'm still not entirely sure how it works. And it might be nice for others to have that summary in the readme anyway.

Here is an example layout I've been using on smaller displays. I'm using HA + ESPhome for data logging, monitoring, load balancing, mostly alternative energy in off grid situations.

PXL_20230328_184845528 PXL_20230105_001906595 MP PXL_20220814_002115625 MP That is a 0-1000A DC shunt monitor I designed a custom PCB for using a ttgo T-Display - and now I just like the simplicity of ESPhome for dashboards at sites that are more stable than trying to have a tablet display the whole home assistant dashboard. And am hoping to use the 5" display as a wall display for general end users to view their system status. I have the YAMLs shared here https://github.com/clowrey/ESPhome-YAML

landonr commented 1 year ago

can we make a new issue for support LovyanGFX? I have a M5stack Fire and StickC Plus I can try getting this working with

patfelst commented 1 year ago

under this repo? I mean this repo is for the Lilygo T-Display-S3. But I'm happy to create a new issue if its ok in this repo.

Also if its specifically for M5Stack products, it would be better to base it on the M5Unified library - which as I mentioned above uses LovyanGFX, but also has all the libraries for the chips the M5Stack products use, like the touch controller, AXP192 I2C power controller (which on some products is used to control the LCD backlight) etc.

clowrey commented 1 year ago

can we make a new issue for support LovyanGFX? I have a M5stack Fire and StickC Plus I can try getting this working with

The m5 stickC plus displays are also supported by library's already in ESPhome too and by this eSPI library if you just the text and stuff. I have an example here using one https://github.com/clowrey/ESPhome-YAML/blob/main/m5stick-cplus-heatpump.yaml

bradmck commented 1 year ago

Just letting you guys know I am still looking at the LovyanGFX library - I just haven't gotten it working yet.

landonr commented 1 year ago

under this repo? I mean this repo is for the Lilygo T-Display-S3. But I'm happy to create a new issue if its ok in this repo.

Also if its specifically for M5Stack products, it would be better to base it on the M5Unified library - which as I mentioned above uses LovyanGFX, but also has all the libraries for the chips the M5Stack products use, like the touch controller, AXP192 I2C power controller (which on some products is used to control the LCD backlight) etc.

yeah i think that is probably the move.

patfelst commented 1 year ago

Yes I agree two different integrations (i.e. two repos) would need to be created because LovyanGFX will span many products and vendors, whereas M5Unified specifically targets M5 Stack products. They are different use cases.

Not sure if you meant for me to create either or both repos, but I don't think I have the coding skills (or time to learn at least) to mange either of these, but I will follow with interest and help test etc. Appreciate you guys working on this!

landonr commented 1 year ago

I can get around to it when i have time and i'll report back. I have both devices

landonr commented 1 year ago

I thought about it a bit and I don't think including LovyanGFX makes sense for esphome. I made a component for one m5stack device here it wasn't that bad https://github.com/landonr/esphome-components/tree/main/components/MiniEncoderC

For AXP192 i've been using this component https://gitlab.com/geiseri/esphome_extras/-/tree/main/components/axp192

genebean commented 8 months ago

FWIW, I just found this and got my setup working with this:

esphome:
  name: ${name}
  friendly_name: ${friendly_name}

esp32:
  board: lilygo-t-display-s3
  variant: esp32s3
  framework:
    type: arduino
    version: 2.0.14
    platform_version: 6.1.0

external_components:
  - source: github://landonr/lilygo-tdisplays3-esphome
    components: [tdisplays3]

Of note, there is a board definition for this now at https://docs.platformio.org/en/latest/boards/espressif32/lilygo-t-display-s3.html

clowrey commented 6 months ago

We are getting 16 bit parallel displays in main ESPhome!! https://github.com/esphome/esphome/pull/5872