landonr / lilygo-tdisplays3-esphome

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

Ili9488 cannot be full screen #22

Open shangjiazi opened 1 year ago

shangjiazi commented 1 year ago

I have an esp32 and ili9488 connected in parallel, which have successfully lit up with your code, but did not fill the entire screen. When I tried to modify the resolution and chip model, it went black. Requesting help, what file should I use to make the screen full and display? thank you

bradmck commented 1 year ago

I'm not sure if this will help you, but you can try the code I talk about in this post: Issue 15

You'd want to use the user_build_flags option and then specify all of the parameters needed for your display.

shangjiazi commented 1 year ago

Thank you for your reply. I conducted the experiment using this method. When I set it to ST7789 and set the pixel size to 170 320, it is displayed normally. But it doesn't apply to my screen. My screen is ILI9488. When I changed to ILI9488 and changed the pixel size to 320 480, it turned black,... If I only change the pixels, it will also fail, and if I only change the chip model, it will also fail.

This is the code that failed me:

display:
  - platform: tdisplays3
    id: disp
    update_interval: 1s
    rotation: 270
    user_build_flags:
      - USER_SETUP_LOADED=1
      - ILI9488_DRIVER
      # - INIT_SEQUENCE_3
      # - CGRAM_OFFSET
      # - TFT_RGB_ORDER=TFT_RGB
      # - TFT_INVERSION_ON=1 
      - TFT_PARALLEL_8_BIT
      - TFT_WIDTH=320
      - TFT_HEIGHT=480
      - TFT_CS=33
      - TFT_DC=15 
      - TFT_RST=32 
      - TFT_WR=4
      - TFT_RD=2 
      - TFT_D0=12 
      - TFT_D1=13 
      - TFT_D2=26 
      - TFT_D3=25 
      - TFT_D4=17 
      - TFT_D5=16 
      - TFT_D6=27 
      - TFT_D7=14 
      - LOAD_GLCD=1 
      - LOAD_FONT2=1 
      - LOAD_FONT4=1 
      - LOAD_FONT6=1 
      - LOAD_FONT7=1 
      - LOAD_FONT8=1 
      - LOAD_GFXFF=1 
      - SMOOTH_FONT=1
shangjiazi commented 1 year ago

tft-spr I have found the problem and successfully displayed it by replacing the original "spr" with "tft" at the marked position. I am a novice, may I ask what the problem is?

patfelst commented 1 year ago

I think you need to add expose_tft_objects: true like this:

display:
  - platform: tdisplays3
    id: disp
    update_interval: 1s
    rotation: 270
    expose_tft_objects: true
patfelst commented 1 year ago

Oh sorry, that only works on @bradmck's branch: https://github.com/bradmck/lilygo-tdisplays3-esphome/tree/OptionToExposeTFTObjects

guillempages commented 1 year ago

@shangjiazi I don't have an ILI9488 display to test, and I'm not sure exactly how it works. Maybe it doesn't have sprite support, and that's why the "spr" calls do not work?

bradmck commented 1 year ago

I'm surprised the current version of this repo works at all since it's using hard-coded driver, pins, etc. I suggested my branch just since it lets you custom define all of the device settings and therefore may just work with any display supported by the current TFT_eSPI. I also don't have one of these and am not sure why the spr calls don't work. I'm curious though, how's the refresh drawing directly to the TFT? Does it flash at all?

And did you try using the ST7789 driver with 320 * 480?

patfelst commented 1 year ago

Did you have the USER_SETUP_ID set to 146 as indicated (here)? In your code above you show it set to 1.

Also on the TFT_eSPI github page it says:

  1. Support for the ESP32-S2, ESP32-S3 and ESP32-C3 has been added (DMA only on ESP32 S3 at the moment).

I don't know if DMA works with ESPHome.

shangjiazi commented 1 year ago

Why TFT_ WIDTH=170 can only be 170, "sprite" can only work properly, I don't know where the error is? Very distressed

guillempages commented 1 year ago

It might be a memory issue; if the width is "too big", it needs to much memory to store the sprites, and this it disables it. I don't know, that's just a guess though.

shangjiazi @.***> schrieb am So., 16. Apr. 2023, 12:17:

Why TFT_ WIDTH=170 can only be 170, "sprite" can only work properly, I don't know where the error is? Very distressed

— Reply to this email directly, view it on GitHub https://github.com/landonr/lilygo-tdisplays3-esphome/issues/22#issuecomment-1510269040, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS6VEY6NULPEYSFGUY2DGLXBPBNDANCNFSM6AAAAAAW2KPGY4 . You are receiving this because you commented.Message ID: @.***>

shangjiazi commented 1 year ago

@guillempages Another interesting thing to discover is that if you still fill in the size of "ST7789" after "spr. createSite" in "tdisplay_s3. h", it will still display normally. Do you need to modify it somewhere to make it full screen? 22222222222222 333333333333

shangjiazi commented 1 year ago

@guillempages I don't think it's a memory issue. If I change it to 171, it will also fail. Can only be 170. Among these programs, where else is there a fixed area related to "st7789" that needs to be modified?

bradmck commented 1 year ago

Have you used this board/display with any basic Arduino/PlatformIO sketches (with TFT_eSPI)? On your question of where the dimensions are set.... If you are using my Beta branch there's only one spot that I set the width and height, and that's only if you don't specify user_build_flags:. That's in the display.py file:

        cg.add_build_flag("-DTFT_WIDTH=170")
        cg.add_build_flag("-DTFT_HEIGHT=320")
shangjiazi commented 1 year ago

@guillempages You are right, asking the spirit to create a 320 * 480 does require a lot of memory, so I can only add "spr. setColorDepth (1);" to reduce memory usage. It successfully displayed. Thank you for your help. The success of ILI9488 means that this great library will support many TFT parallel port screens

bradmck commented 1 year ago

@shangjiazi - I'm working to add a color_depth: option to my Beta branch but I'm a bit of an idiot with this stuff so it's not quite working yet. :) I'll reply here when that's ready if you're interested in testing. My beta branch is the one that also allows specifying user_build_flags for the TFT_eSPI library.

bradmck commented 1 year ago

My Beta branch now supports a color_depth: option. Valid choices are 1, 4, 8, and 16. Default is 8. I've done very little testing but it seems to work.

shangjiazi commented 1 year ago

@bradmck It has been tested and it has been successful. excellent. Suggest renaming your "Beta branch" to make it more widely known. It does not fully support "tdisplays3" and "ST7789", and all "tft_espi" serial ports are supported

bradmck commented 1 year ago

@shangjiazi - I'm glad that worked for you but I'm not quite ready with that branch. In theory since you can specify your own settings for TFT_eSPI it's quite possible that it will work with any display supported by that library. But I don't have any other displays to test with at this point. I'm not sure what you mean by your reference to "serial ports are supported"? It technically should work for both serial and parallel displays.

shangjiazi commented 1 year ago

@bradmck Nice to have a conversation with you again. Your code has indeed helped me a lot and has become my pleasure. I have made modifications to my code. Due to memory issues, you have added the "color_depth:" setting to the original code. I have made new progress again because memory cannot create 320 480 "eSprines", but two 320 240 "eSprines" can be created. It can achieve 8-bit 'colordepth', and we only need to display_ S3. h Create two eSpites and let it determine which "eSpite" to push to.

I am using translation software to communicate with you, hoping to arouse everyone's interest.

clowrey commented 1 year ago

I'm curious what display board do you have there? Or is it something custom?