rzeldent / esp32-smartdisplay

PlatformIO library LVGL Drivers for Sunton Smart display boards (CYD Cheap Yellow Display). This library supports these boards without any effort. ESP32-2432S024N/R/C, ESP32-2432S028R/C, ESP32-3248S035R/C, ESP32_8048S070N/C
https://github.com/rzeldent/platformio-espressif32-sunton
GNU General Public License v3.0
399 stars 70 forks source link

Weird colors with esp32-8048S070C #60

Closed Andre-Schuiki closed 7 months ago

Andre-Schuiki commented 9 months ago

Hi all,

i tried the demo application but can't get the screen to work correct. My colors looking weird...any ideas what i'm doing wrong?

image

This is my platformio.ini

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = esp32-8048S070C

[env]
platform = espressif32
framework = arduino

monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
monitor_filters = esp32_exception_decoder

# Partition scheme for OTA
board_build.partitions = min_spiffs.csv

build_flags =
    -Ofast
    -Wall
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
    # LVGL settings
    -DLV_CONF_PATH=${PROJECT_INCLUDE_DIR}/lv_conf.h

#lib_deps = rzeldent/esp32_smartdisplay
lib_deps =
    https://github.com/rzeldent/esp32-smartdisplay.git
    https://github.com/schreibfaul1/ESP32-audioI2S

[env:esp32-8048S070C]
board = esp32-8048S070C
rzeldent commented 9 months ago

Hi Andre,

Looks like the LV_COLOR16_SWAP is incorrect.

Andre-Schuiki commented 9 months ago

Yeah that's what i thought too but i already tried with swap enabled and get the same result.

I will try it again tomorrow and give you feedback.

Thanks for your help!

rzeldent commented 9 months ago

It can be that you need to rebuild the library. The define is only taken into account when compiling thew library (that is cached). Retry it but delete the .pio directory first. It is also possible that you need to change the settings in Squareline to be able to compile... This should have been solved in the 2.0.x versions?!

Andre-Schuiki commented 9 months ago

It can be that you need to rebuild the library. The define is only taken into account when compiling thew library (that is cached). Retry it but delete the .pio directory first. It is also possible that you need to change the settings in Squareline to be able to compile... This should have been solved in the 2.0.x versions?!

Ok i have tried with LV_COLOR_16_SWAP 1 but i get the same result. (i also have deleted the .pio folder before compiling)

IanSC commented 9 months ago

I have the same issue as this. Edited lv_conf.h and changed

#define LV_COLOR_16_SWAP 0

Did a PIO: Clean by clicking the trash can before uploading. Got the correct photo color, but text are garbled and the colors for widgets are off. eg. green border, greenish background, avocado button

esp32-8048S070C



Tried it on another device and it appears correct (set the swap var to 1 since SPI).

esp32-3248S035C



Not sure if related, but the downloaded library does not contain ST7701 files.

Thanks for the help and the great library!

rzeldent commented 9 months ago

Hi IanSC,

Maybe the 16 bits color array is swapped, that's what I suspect. You can try to swap it by manually by setting in lvgl_rgb_panel.c the color 16 swap, just for testing:

// Create direct_io panel handle
#if LV_COLOR_16_SWAP != 0

Ordered the 8048S070C and will hopefully be able to reproduce it and correct it.

IanSC commented 9 months ago

Hi rzeldent,

A: lv_conf.h #define LV_COLOR_16_SWAP <value> B: lvgl_rgb_panel.c, line 28 #if LV_COLOR_16_SWAP <operator> 0

A < value > B < operator > Image Text Colors
1 != inverted garbled off
0 != okay garbled off
1 == inverted garbled off
0 == okay garbled off

Thanks for checking this out.

rzeldent commented 9 months ago

Hi LanC,

Thanks for testing this. I was hoping it was just a typo... So basically the text is always garbled.... Have you tried inverting the image? esp_lcd_panel_invert_color(handle, true);

Hopefully will receive the board this week!

IanSC commented 9 months ago

Hi rzeldent,

Took me a while to figure out where to the add the line of code.

I also tried the other cases from your previous suggestion. I doubted there would be any difference since it's a text issue not color, but surprisingly it got much better.

Thanks again!

in lvgl_rgb_panel.c, added: ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, true));       at the end of the function lvgl_lcd_init()

A: lv_conf.h #define LV_COLOR_16_SWAP <value> B: lvgl_rgb_panel.c, line 28 #if LV_COLOR_16_SWAP <operator> 0

CASE A < value > B < operator > Image Text Colors Shade Note
1 1 == inverted garbled off none
2 0 == wrong garbled off purple
3 1 != wrong okay off dark purple
4 0 != inverted okay okay none FPS overlay seems off

CASE 1

CASE 2

CASE 3

CASE 4

IanSC commented 9 months ago

Additional Test: Just reporting here to help solve any potential issues. I don't remember the colors being so far off with the built in app that came with the device.

TIP: Don't use the included cable! USB-C to USB-C does not work for me. Use C to A, A to C cable. (Port is old USB in C form factor.)

These are not bug reports, just observations. Big screen is yellowish and less brighter. Added:

void setup() {
    ...
    smartdisplay_init();
    // smartdisplay_lcd_set_backlight(1.0f); // screen flickers
    // smartdisplay_lcd_set_backlight(0.9f); // screen flickers
    smartdisplay_lcd_set_backlight(0.5f);    // screen flickers
    ...
    tutorialCode();
}
void loop() {
    lv_timer_handler();
}

Changing the brightness causes the screen to flicker and become unstable, even if set to 0.5f which is the same inside smartdisplay_init(). I might be calling it in the wrong place.

Button test seems normal, except for overlay. Solid RGB colors are off.

IMG_20240108_213810 IMG_20240108_222219 IMG_20240108_222239 IMG_20240108_222254

IanSC commented 8 months ago

Hi rzeldent,

Based on: Esp32-8048S070 display, different version https://github.com/rzeldent/esp32-smartdisplay/issues/90

I tried the settings for v1.3 and the text and colors are correct.

For noobs like me:

IanSC commented 8 months ago

Tried LVGL examples with the changes and it works. Except for slight flickers...

Thanks to @rzeldent !

So guys, let's support or buy this guy a beer, without his efforts these boards will be useless or extremely difficult to use. Looking at you Sunton.

rzeldent commented 8 months ago

Thanks!

BTW in the develop the v1.3 board will be the default. Think the v1.1 was some typo.

MrOptifine commented 7 months ago

Any idea on how to fix the screen flickers?

rzeldent commented 7 months ago

Hi Optifine,

I think the PCLK needs tweaking....