landonr / lilygo-tdisplays3-esphome

tdisplay s3 170x320 running esphome using patched tft_espi
90 stars 31 forks source link

New T-Display-S3 AMOLED version #25

Open hapklaar opened 1 year ago

hapklaar commented 1 year ago

I just got this new board, which seems to be a variant of the original T-Display-S3 version. It has an AMOLED screen with a higher resolution (240*536)

Would it be possible to add support for this board in your code?

guillempages commented 1 year ago

Without having the hardware myself it's difficult to say ;-) Especially without the possibility of debugging.

Could you try just using the normal t-display-s3 and specifying the resolution manually?

display:
   platform: tdisplays3
   width: 240
   height: 536
   #...

I don't think it is that easy, but it's worth a shot

hapklaar commented 1 year ago

Unfortunately didn't work :(

Screen stays black and a green led is on below the bottom right button. Looks like addressing is different on this one.

edit: It seems to be crashing actually:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x420cad7e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x43c
load:0x403c9700,len:0xbec
load:0x403cc700,len:0x2a3c
entry 0x403c98d8
E (250) psram: PSRAM ID read error: 0x00ffffff
hapklaar commented 1 year ago

Upon second try, it actually flashed correctly and booted, but nothing on display. It seems this device is using a totally different display controller

landonr commented 1 year ago

It doesn't seem too difficult to set this up if we follow the example code https://github.com/Xinyuan-LilyGO/T-Display-S3-AMOLED/blob/main/examples/TFT_eSPI_Sprite/rm67162.h I'll look into buying one of these tdisplays, they're really nice

hapklaar commented 1 year ago

I'll look into buying one of these tdisplays, they're really nice

That's cool. Let me do a small contribution to the cause ;)

landonr commented 1 year ago

Thank you very much! @guillempages have you looked into an amoled s3? If you havent

guillempages commented 1 year ago

No, I haven't.

julianrinaldi commented 1 year ago

I would also love support for this version. I bought a few not realizing it was a newer unsupported model. But it's probably going to be my favorite ESPHome device once it's possible to use it.

bluechris commented 1 year ago

Yeah i also got the devide here and in the life of me i cannot make the screen to light up with Esphome...

landonr commented 1 year ago

can you check if your boards are set up for spi or qspi? image

if its qspi then I think we need to include this rm67162.h file and call init like this rm67162_init();

https://github.com/Xinyuan-LilyGO/T-Display-S3-AMOLED/blob/eec58359ca665510dcd0bdae5d0b78a7fc383a34/examples/TFT_eSPI_Sprite/TFT_eSPI_Sprite.ino#L39C20-L39C20

julianrinaldi commented 1 year ago

It looks like QSPI.

hapklaar commented 1 year ago

Can confirm, board looks identical to the left pic with the zero ohm resistors on QSPI. If there is anything I can try or test please let me know!

hapklaar commented 11 months ago

Curious if anyone was able to make some progress on this?

guillempages commented 11 months ago

I haven't, and AFAIK @landonr hasn't either. BUT @clydebarrow has a branch on his esphome fork that actually has support for that device. He has posted his configuration on discord, so I'm pasting the relevant parts here, in case you want to try:

esphome:
  name: t-amoled
  platformio_options:
    build_unflags: -Werror=all
    board_build.flash_mode: dio

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  framework:
    type: esp-idf

external_components:
  - source: github://clydebarrow/esphome@amoled
    components: [ spi, qspi_amoled]

spi:
  - id: quad_spi
    clk_pin: 47
    data_pins:
      - 18
      - 7
      - 48
      - 5
display:
  - platform: qspi_amoled
    dimensions:
      height: 240
      width: 536
      offset_height: 0
      offset_width: 0
    transform:
      mirror_x: false
      mirror_y: true
      swap_xy: true
    color_order: rgb
    invert_colors: false
    brightness: 255
    cs_pin: 6
    reset_pin: 17
    enable_pin: 38
    lambda: |-

psram:
  mode: octal
hapklaar commented 11 months ago

That's very promising 👍

Unfortunately it fails to compile on the spi part. Any idea what the issue could be?

INFO ESPHome 2024.1.0-dev
INFO Reading configuration /config/esphome/t-amoled.yaml...
INFO Generating C++ source...
Traceback (most recent call last):
  File "/usr/local/bin/esphome", line 33, in <module>
    sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 1041, in main
    return run_esphome(sys.argv)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 1028, in run_esphome
    rc = POST_CONFIG_ACTIONS[args.command](args, config)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 407, in command_compile
    exit_code = write_cpp(config)
                ^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 192, in write_cpp
    generate_cpp_contents(config)
  File "/esphome/esphome/__main__.py", line 204, in generate_cpp_contents
    CORE.flush_tasks()
  File "/esphome/esphome/core/__init__.py", line 679, in flush_tasks
    self.event_loop.flush_tasks()
  File "/esphome/esphome/coroutine.py", line 246, in flush_tasks
    next(task.iterator)
  File "/esphome/esphome/__main__.py", line 184, in wrapped
    await coro(conf)
  File "/data/external_components/c09bccb9/esphome/components/spi/__init__.py", line 334, in to_code
    vec_id = cg.new_variable(
             ^^^^^^^^^^^^^^^^
  File "/esphome/esphome/cpp_generator.py", line 532, in new_variable
    rhs = safe_exp(rhs)
          ^^^^^^^^^^^^^
  File "/esphome/esphome/cpp_generator.py", line 381, in safe_exp
    raise ValueError("Object is not an expression", obj)
ValueError: ('Object is not an expression', None)
clydebarrow commented 11 months ago

There are core changes that don't get pulled in with external components. If you clone the branch and build using that it will work.

hapklaar commented 11 months ago

Thanks @clydebarrow

Great success! This screen is so pretty... 20231217_020400

PS fyi, only issue with the code is that the logger component won't compile for some reason. Had to comment it out, otherwise would get the following error:

/data/cache/platformio/packages/framework-espidf/components/esp_system/port/soc/esp32s3/usb_console.c:77:1: error: static assertion failed: "usb_osglue_*_int is not multicore capable"
 _Static_assert(SOC_CPU_CORES_NUM == 1, "usb_osglue_*_int is not multicore capable");
 ^~~~~~~~~~~~~~
*** [.pioenvs/tdisplay-s3-amoled-temp/esp_system/port/soc/esp32s3/usb_console.o] Error 1
clydebarrow commented 11 months ago

hardware_uart: USB_SERIAL_JTAG is your friend. This will be the default for S3 in the next ESPHome release.

sandryseibert commented 11 months ago

There are core changes that don't get pulled in with external components. If you clone the branch and build using that it will work.

When I use the code above, I get erros like Unknown Platform, variable does not support pins schema. How do you guys compile this thing? I'm accessing my ESPHome local server and clicking Edit to then load the code. However many red X appear.

guillempages commented 11 months ago

@sandryseibert As Clyde mentioned above (https://github.com/landonr/lilygo-tdisplays3-esphome/issues/25#issuecomment-1858975864) you need to clone his repo/branch, and use that to build your configuration. It's not enough to edit your yaml code; there are changes on core components there, that cannot be pulled in as external components. AFAIK this only works from the command line; not the web server or the HA Addon, but I haven't tried those and might be mistaken. As a matter of fact, I haven't tried Clyde's code either, since I don't have the AMOLED version of the display 😂

sandryseibert commented 11 months ago

@sandryseibert As Clyde mentioned above (#25 (comment)) you need to clone his repo/branch, and use that to build your configuration. It's not enough to edit your yaml code; there are changes on core components there, that cannot be pulled in as external components. AFAIK this only works from the command line; not the web server or the HA Addon, but I haven't tried those and might be mistaken. As a matter of fact, I haven't tried Clyde's code either, since I don't have the AMOLED version of the display 😂 @guillempages , thank you so much. I'm a basic user so I'll have to figure out how to compile the bin file externally.

hapklaar commented 11 months ago

FYI: I added the ESPHome (dev) add-on to my HAOS machine. That created a new docker container in which I cloned Clyde's amoled branch. Then went to the Web UI of that add-on and could create the device and compile.

You will need the 'HassOS SSH port 22222 Configurator' to be able to login as root to the box to change the contents of that Docker container.

Kratax commented 10 months ago

Hi guys, would there be any "easier" option how to make this display work on esphome in home assistant. I believe it's really a beautiful one and would be nice to have it in...

clydebarrow commented 10 months ago

It's waiting for various PRs to be merged. With the holiday break the PRs have been slow to be reviewed. Once that is done it will be much easier.

adrianrdzv commented 10 months ago

Got a S3 amloed but having a hard time finding the aforementioned branch... Anyone care to point me to it?

hapklaar commented 10 months ago

Got a S3 amloed but having a hard time finding the aforementioned branch... Anyone care to point me to it?

Here you go: https://github.com/clydebarrow/esphome/tree/amoled

clydebarrow commented 9 months ago

Hi guys, would there be any "easier" option how to make this display work on esphome in home assistant. I believe it's really a beautiful one and would be nice to have it in...

Stuff has been merged, so it can be built just with external components now. Full config here: https://community.home-assistant.io/t/any-way-to-get-the-new-t-display-s3-amoled-to-work-with-esphome/601414/7?u=clydebarrow

keramahos commented 4 months ago

hey guys. Any idea how to add support for this AMOLED too? https://www.lilygo.cc/products/t-encoder-plus it seems to be a clone of their "usual" amoleds but seems to have different controller... https://github.com/Xinyuan-LilyGO/T-Encoder-Pro already supported on multiple other platforms...

with this config: - platform: qspi_amoled id: my_display model: RM690B0 dimensions: height: 390 width: 390 offset_height: 0 offset_width: 0 transform: mirror_x: false mirror_y: false swap_xy: true color_order: rgb invert_colors: false brightness: 175 cs_pin: 10 reset_pin: 4 enable_pin: 3

I am able to lit up the display and make a clock appear on it, but there is a pixel mess around which is not ideal :) thanks. @clydebarrow @hapklaar