Closed Grey-Lancaster closed 3 months ago
Could you tell which images i see with the test patron? From what i get you tested with a ili9341 and ili9342 is it not?
Sorry, I do not understand your question. the first 2 pics are with display:
and I chaged to bgr for one Grey
I am assuming the ili9341 test pattern is correct because all works fine, Neither of the ili9342 test patterns match the 9341 is why I think I have issues I updated my first post to perhaps make it better. Thanks, Grey
can you show me again the test patronen van de ili9342 display's? It is me not clear which image belongs to those displays,
display:
display:
Are you sure it is a ili9342 and not a ili9341? Anyway on TFT_eSPI there is an other config file for this kind of displays. I will create a PR for this one in a moment so you can see of it will work or not.
Hmm just wondering, did you try to add invert_colors: true
to the display?
Like: NEW HARDWARE VERSION WITH USB-C CONNECTOR: for this, the display component needs to be set up like the following (model ili9342, no rotation, inverted)
display:
- platform: ili9xxx
id: esp_display
model: ili9342
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
#invert_display: true (changed to below with ESPhome 2023.12.0)
invert_colors: true
It is a 9342, 9341 does not fill the screen, is rotated and scrambled. invert_colors: true does that exactly. My black becomes white
The problem is my image. It is like the 9342 only has 4bytes of color, not 256
this is with invert=true
Okey, that was not the solution then :D
lets try the init code i found on TFT_eSPI:
external_components:
- source: github://pr#6125
refresh: 1s
components: [ ili9xxx ]
display:
- platform: ili9xxx
model: cyd_ili9342
...
let me know how it go's.
Not sure if I am doing this right? I also have an error about model: cyd_ili9342
esphome:
name: cyd1
friendly_name: CYD1
esp32:
board: esp32dev
framework:
type: arduino
external_components:
- source: github://pr#6125
refresh: 1s
components: [ ili9xxx ]
INFO ESPHome 2023.12.8
INFO Reading configuration /config/esphome/cyd1.yaml...
INFO Updating https://github.com/esphome/esphome.git@pull/6125/head
ERROR Unable to import component ili9xxx.display:
Traceback (most recent call last):
File "/esphome/esphome/loader.py", line 169, in _lookup_module
module = importlib.import_module(f"esphome.components.{domain}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/data/external_components/58ba9074/esphome/components/ili9xxx/display.py", line 7, in <module>
from esphome.const import (
ImportError: cannot import name 'CONF_MIRROR_X' from 'esphome.const' (/esphome/esphome/const.py)
INFO Detected timezone 'America/New_York
okay, i think that has todo with the esphome branch, could you setup the DEV version of esphome?
let me google :-)
Do you not run Home Assistant OS? when you you can install the esphome DEV add-on
No download errors
esp32:
board: esp32dev
framework:
type: arduino
external_components:
- source: github://pr#6125
refresh: 1s
components: [ ili9xxx ]
display:
- platform: ili9xxx
model: cyd_ili9342
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
rotation: 90
color_order: RGB
id: "my_display"
pages:
INFO ESPHome 2024.1.0-dev
INFO Reading configuration /config/esphome/cyd1.yaml...
INFO Updating https://github.com/esphome/esphome.git@pull/6125/head
INFO Detected timezone 'America/New_York'
WARNING GPIO12 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO15 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO2 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing cyd1 (board: esp32dev; framework: arduino; platform: platformio/espressif32@5.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 2.0.1
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.1.0
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.4
|-- SPI @ 2.0.0
Compiling .pioenvs/cyd1/src/main.cpp.o
src/main.cpp: In function 'void setup()':
src/main.cpp:1574:20: error: expected type-specifier
my_display = new ili9xxx::ILI9XXXCYD_ILI9342();
^~~~~~~
*** [.pioenvs/cyd1/src/main.cpp.o] Error 1
========================= [FAILED] Took 11.13 seconds =========================
Oww my error i renamed something that i forgot to update somewhere else.
Just try again please.
Glad the error meant something to you :-) Colors ar still off and my text is reversed (mirror image) Let me load up the test pattern for you
display:
- platform: ili9xxx
model: cyd_ili9342
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
rotation: 0
color_order: RGB
id: "my_display"
you should not need to use color_order: RGB
Is there any color difference between the we did have before?
Oww could you add invert_colors: false
as well.
the image was still bland invert colors false or true?
false now.
aw i messed up the color test coming next
display:
- platform: ili9xxx
model: cyd_ili9342
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
rotation: 0
invert_colors: false
id: "my_display"
that does not look good :(
display:
- platform: ili9xxx
model: cyd_ili9342
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
rotation: 0
invert_colors: false
id: "my_display"
okay i made some small changes maybe this fixed it.
Seems like others around are tweaking the ili9341 LCD wiki has no mention of an ili9342 I am just using 9342 as it all works except for the color depth. I have no documentation that says that is what it is. Can't find it now but saw somewhere v2 was with the usb c. This page as a vendor config file that makes no sense to me but perhaps it does to you https://github.com/rzeldent/platformio-espressif32-sunton/blob/main/esp32-2432S028Rv2.json
Thanks for your help, Grey
Did you save your changes? :-) I cannot tell any difference. invert_colors true has the right colors but the text is still backwards and the image still has no depth/colors
let me look at what that link gives as init string it. it will take a while
Okay, let us see of this init code will work.
all I have to do is install again correct? The refresh: 1s is supposed to pull the new code? I cannot see any changes on the display
INFO ESPHome 2024.1.0-dev INFO Reading configuration /config/esphome/cyd1.yaml... INFO Updating https://github.com/esphome/esphome.git@pull/6125/head INFO Detected timezone 'America/New_York'
that is correct.
When this is still not working, could you ask the vendor from who you ordered this display for example code?
I will have to try their code. It was displaying something when I first plugged it in I have one of the files from this link but the password did not work for another. I tried chatting with them but got nowhere. Will check back tomorrow and let you know Thanks again, Grey
ESP32-2432S028R download link: http://www.jczn1688.com/zlxz Download password: jczn1688
The examples were not for an esp32 is why I did not make much progress
// IMPORTANT: LCDWIKI_SPI LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
//This program is a demo of how to display picture and
//how to use rotate function to display string.
//when using the BREAKOUT BOARD only and using these hardware spi lines to the LCD,
//the SDA pin and SCK pin is defined by the system and can't be modified.
//if you don't need to control the LED pin,you can set it to 3.3V and set the pin definition to -1.
//other pins can be defined by youself,for example
//pin usage as follow:
// CS DC/RS RESET SDI/MOSI SDO/MISO SCK LED VCC GND
//Arduino Uno A5 A3 A4 11 12 13 A0 5V/3.3V GND
//Remember to set the pins to suit your display module!
/***********************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, QD electronic SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
**********************************************************************************/
#include <LCDWIKI_GUI.h> //Core graphics library
#include <LCDWIKI_SPI.h> //Hardware-specific library
//paramters define
#define MODEL ILI9341
#define CS A5
#define CD A3
#define RST A4
is that password correct? i cant get that file being downloaded with it.
I just realized the file I downloaded on page 2 cannot be right if it is talking about uno and this is an esp32.
Yes, that was the problem I had with the password. I was chatting with the vendor for 15 mins and stepped away to come back and said I was gone too long and it closed. I will try them again
I have to leave but I will try this http://pan.jczn1688.com/1/ESP32%20module
The files I found are esp-idf and I am not getting anywhere. From that link above. Is this helpful?
Step 5: Create a settings file for LVGL LVGL needs a configuration file; lv_conf.h. This file contains information about the fonts, color depths, default background, styles, etc... The default LVGL template can be found in the LVGL library at the location: lvgl/lv_conf_template.h. This file must be copied to the include directory and renamed to lvgl_conf.h. Also the #if 0 must be removed to enable the file to be included. More information about setting up a project with LVGL can be obtained at LVGL get-started/quick-overview. I suggest to put the lv_conf.h file in the include directory and set the build flags to specify the location of the file, see below.
Tip
LVGL can also be downloaded manually from: https://github.com/lvgl/lvgl/archive/master.zip to extract the template. The template can also be copied from the demo application.
Important settings are:
Only the R5G6B5 format is supported on these panels.
/Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)/
Because of the SPI interface, the bytes are sent in big endian format so this must be corrected. The RGB panel interface takes care of this by swapping the GPIO lines but for the SPI controllers this is not optimal. More information about this can be found below.
/Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)/
To have a time reference use the milliseconds reference for the Arduino
/Use a custom tick source that tells the elapsed time in milliseconds and enables this code./
/It removes the need to manually update the tick with lv_tick_inc()
)/
For debugging, enable CPU usage, FPS (Frames per Second) and memory defragmentation
(Optionally) Include additional fonts.
...
... Optionally, only enable widgets that are used to save on code
...
okay, i will guide you:
~Do you have TFT_eSPI installed? then replace it with files in 1-Demo\Demo_Arduino\libraries\TFT_eSPI
folder to your libraries
folder.
Open User_Setup_Select.h
in that folder and add a // for #include <User_Setup.h>
this allows us to define our own in the demo later. Restart the arduino IDE. And do not update the package. not sure of they made other changes.~
Now copy the file 1-Demo\Demo_Arduino\3_4-1_TFT_Rainbow\TFT_eSPI bottom layer replacement file
to '1-Demo\Demo_Arduino\3_4-1_TFT_Rainbow\3_4_TFT_Rainbow'
Modify now the 3_4_TFT_Rainbow.ino
file by adding:
#define USER_SETUP_LOADED
#include "User_Setup.h"
on top of the file and run it.
That should work (i hoop).
EDIT: made the changes simpler.
Thank you for your patience and help I was trying to do the idf demo not arduino
I did have to replace the tft_eSPI library as all I got was a blank screen. It does ~work the colors are inverted Black is white, red is blue
hold on
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
#define TFT_INVERSION_ON
// #define TFT_INVERSION_OFF
Could you humor me and show the backside of it.
That was the wrong place for me to try to fix the colors, trying that now sorry that came out upside down
https://www.aliexpress.us/item/3256805974330395.html funny, haha colors do not change? neither makes a difference. In esphome I need BGR
// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
where do you change those settings?
Is that an USB-C or micro USB connector on the rightside?
USB-C in the middle is what I am using micro is next to it user setup.h
Can we try the ili9341 one more time with the following display settings:
display:
- platform: ili9xxx
model: ili9341
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
id: "my_display"
dimensions: 320x240
transform:
mirror_y: false
mirror_x: false
swap_xy: true
You can play with the "transform setting" and dimension until your screen looks okay.
This works but the image is still bad note I had to change the dimensions and add the color order
image:
- file: http://192.168.1.50:8123/local/dad2.PNG
id: my_image
resize: 120x120
type: RGBA
looks the same as type:RGB565
display:
- platform: ili9xxx
model: ili9341
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
id: "my_display"
dimensions: 240X320
color_order: RGB
transform:
mirror_y: false
mirror_x: false
swap_xy: true
The text looks fine, just a bad picture. I mean I took a bad picture of the display
This is from a Lolin 2.4 tft Not a great picture either but perhaps you can see the diff in the image. color types worked on this board also
Are those two from the "same" YAML script?
Basicly just diff pins and boards
Lolin
image:
- file: http://192.168.1.50:8123/local/dad2.PNG
id: my_image
resize: 120x120
type: RGBA
spi:
clk_pin: 18
mosi_pin: 23
miso_pin: 19
°
display:
- platform: ili9xxx
model: ili9341
cs_pin: 14
dc_pin: 27
reset_pin: 33
data_rate: 20Mhz
spi_mode: mode0
id: "my_display"
pages:
Suntron CYD with usb c
image:
- file: http://192.168.1.50:8123/local/dad2.PNG
id: my_image
resize: 120x120
type: RGBA
# ============================================================
# Home Assistant related setup
#
light:
- platform: monochromatic
output: backlight_pwm
name: Display Backlight
id: backlight
restore_mode: ALWAYS_ON
# ============================================================
# Hardware related setup
#
# Setup SPI for the display. The ESP32-2432S028R uses separate SPI buses for display and touch
spi:
- id: tft
clk_pin: GPIO14
mosi_pin: GPIO13
miso_pin: GPIO12
- id: touch
clk_pin: GPIO25
mosi_pin: GPIO32
miso_pin: GPIO39
# Setup a pin to control the backlight
output:
- platform: ledc
pin: GPIO21
id: backlight_pwm
# Setup the ili9xxx platform
#
# Display is used as 240x320 by default so we rotate it to 90°
display:
- platform: ili9xxx
model: ili9341
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
id: "my_display"
dimensions: 240X320
color_order: RGB
transform:
mirror_y: false
mirror_x: false
swap_xy: true
pages:
Hmm did i never asked for the startup log? The only thing i can still think of is that it have no PSRAM onboard and esphome switch to 8bit colors on this device.
The problem
The problem is images only show 3 colors maybe/ Not at all like the ili9341
Color test BGR ili9342 which displays text properly
Color test RGB ili9342 colors for text are wrong
Lolin ili9341 color test which I am led to believe is correct
Lolin ili 9341 image
CYD ILI9342 image
Which version of ESPHome has the issue?
2023.12.7
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2023.12.4
What platform are you using?
ESP32
Board
CYD ESP32-2432S028R
Component causing the issue
ili9xxx
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response