8000 fix(examples): fix `LVGL_PORT_ROTATION_DEGREE` issue by Lzw655 · Pull Request #89 · esp-arduino-libs/ESP32_Display_Panel · GitHub
[go: up one dir, main page]

Skip to content

fix(examples): fix LVGL_PORT_ROTATION_DEGREE issue #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 30, 2024

Conversation

@Lzw655 Lzw655 force-pushed the bugfix/fix_LVGL_PORT_ROTATION_DEGREE_issue branch 2 times, most recently from ddb9425 to 77167a2 Compare July 28, 2024 03:15
@Lzw655
Copy link
Collaborator Author
Lzw655 commented Jul 29, 2024

Hi @lboue, Could you please help me test this PR to see if the related bugs are resolved? Thank you very much.

@Lzw655 Lzw655 force-pushed the bugfix/fix_LVGL_PORT_ROTATION_DEGREE_issue branch 2 times, most recently from 3c7e29a to e9d59f3 Compare July 29, 2024 11:30
@lboue
Copy link
Contributor
lboue commented Jul 29, 2024

@Lzw655
I've just done a test building WifiClock example for my CrowPanel 7.0 screen. I no longer have any issues compiling this branch fix_LVGL_PORT_ROTATION_DEGREE_issue.

@lboue
Copy link
Contributor
lboue commented Jul 29, 2024

I am having an issue with GPIO expander and Waveshare_ESP32_S3_Touch_LCD_4_3 board because I2C bus is already initialized:

Build error

d:\ESP32_Display_Panel-bugfix-fix_LVGL_PORT_ROTATION_DEGREE_issue\libraries\ESP32_Display_Panel\src\ESP_Panel.cpp: In member function 'bool ESP_Panel::init()':
d:\ESP32_Display_Panel-bugfix-fix_LVGL_PORT_ROTATION_DEGREE_issue\libraries\ESP32_Display_Panel\src\ESP_Panel.cpp:446:65: error: 'ESP_PANEL_EXPANDER_HOST' was not declared in this scope; did you mean 'ESP_PANEL_EXPANDER_NAME'?
  446 |         expander_ptr = CREATE_EXPANDER(ESP_PANEL_EXPANDER_NAME, ESP_PANEL_EXPANDER_HOST, ESP_PANEL_EXPANDER_I2C_ADDRESS);
      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~
d:\ESP32_Display_Panel-bugfix-fix_LVGL_PORT_ROTATION_DEGREE_issue\libraries\ESP32_Display_Panel\src\ESP_Panel.cpp:48:85: note: in definition of macro '_CREATE_EXPANDER'
   48 | #define _CREATE_EXPANDER(name, host_id, address) make_shared<ESP_IOExpander_##name>(host_id, address)
      |                                                                                     ^~~~~~~
d:\ESP32_Display_Panel-bugfix-fix_LVGL_PORT_ROTATION_DEGREE_issue\libraries\ESP32_Display_Panel\src\ESP_Panel.cpp:446:24: note: in expansion of macro 'CREATE_EXPANDER'
  446 |         expander_ptr = CREATE_EXPANDER(ESP_PANEL_EXPANDER_NAME, ESP_PANEL_EXPANDER_HOST, ESP_PANEL_EXPANDER_I2C_ADDRESS);
      |                        ^~~~~~~~~~~~~~~

ESP32_S3_Touch_LCD_4.3.h Config

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// Please update the following macros to configure the IO expander //////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Set to 0 if not using IO Expander */
#define ESP_PANEL_USE_EXPANDER          (1)         // 0/1
#if ESP_PANEL_USE_EXPANDER
/**
 * IO expander name.
 */
#define ESP_PANEL_EXPANDER_NAME         CH422G

/* IO expander Settings */
/**
 * If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance.
 * It is useful if other devices use the same host. Please ensure that the host is initialized only once.
 */
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST       (1)     // 0/1
/* IO expander parameters */
#define ESP_PANEL_EXPANDER_I2C_ADDRESS          (0x24)
#if !ESP_PANEL_EXPANDER_SKIP_INIT_HOST
    #define ESP_PANEL_EXPANDER_HOST_ID          (0)     // Typically set to 0
    #define ESP_PANEL_EXPANDER_I2C_CLK_HZ       (400 * 1000)
                                                        // Typically set to 400K
    #define ESP_PANEL_EXPANDER_I2C_SCL_PULLUP   (0)     // 0/1
    #define ESP_PANEL_EXPANDER_I2C_SDA_PULLUP   (0)     // 0/1
    #define ESP_PANEL_EXPANDER_I2C_IO_SCL       (18)
    #define ESP_PANEL_EXPANDER_I2C_IO_SDA       (8)
#endif
#endif /* ESP_PANEL_USE_EXPANDER */

Serial log

============ Before Setup End ============
Squareline WiFi clock example start
[   922][W][STA.cpp:537] disconnect(): STA already disconnected.
Initialize panel device
D (431) ESP_Panel: Panel init start
D (432) ESP_Panel: Use LCD
D (432) ESP_Panel: Use RGB bus
D (432) ESP_Panel: Create LCD bus
D (434) ESP_Panel: Create LCD device
D (437) ESP_Panel: Use touch
D (440) ESP_Panel: Use I2C bus
D (443) ESP_PanelHost: Add host I2C[0]
D (446) ESP_Panel: Create touch bus
D (449) ESP_Panel: Create touch device
D (453) ESP_Panel: Use IO expander
D (456) ESP_PanelHost: Host I2C[0] is already exist
E (460) ESP_PanelHost: addHostI2C(38): Attempt to add with a different configuartion
E (468) ESP_Panel: init(443): Add host failed
D (472) GT911_CPP: Destroyed
D (475) ESP_PanelBus_I2C: Destroyed
D (478) ST7262_CPP: Destroyed
D (480) ESP_PanelBus_RGB: Destroyed
D (484) ESP_PanelHost: Destroyed
E (487) ESP_Panel: begin(469): Panel is not initialized
Initialize LVGL
D (502) ESP_Panel: Get invalid LCD pointer
D (502) ESP_Panel: Get invalid touch pointer
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400556d5  PS      : 0x00060930  A0      : 0x820ed6f2  A1      : 0x3fceb990
A2      : 0x00000254  A3      : 0x00000250  A4      : 0x000000ff  A5      : 0x0000ff00
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x3fceb950
A10     : 0x00000000  A11     : 0x3c120778  A12     : 0x00000000  A13     : 0x00000000
A14     : 0x00000000  A15     : 0x3fc98ba4  SAR     : 0x00000004  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000254  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xffffffff


Backtrace: 0x400556d2:0x3fceb990 0x420ed6ef:0x3fceb9a0 0x420f5166:0x3fcebcc0 0x420f51a2:0x3fcebd50 0x42039d9d:0x3fcebd90 0x4207c2b4:0x3fcebdd0 0x420052b7:0x3fcebe50 0x42004cfa:0x3fcebec0 0x4203ae67:0x3fcebef0 0x403834a6:0x3fcebf10

@Lzw655
Copy link
Collaborator Author
Lzw655 commented Jul 30, 2024

@lboue Sorry, this issue is indeed a bug in the file ESP_Panel_Board_Custom.h. The macro ESP_PANEL_EXPANDER_HOST_ID should be placed outside the macro ESP_PANEL_EXPANDER_SKIP_INIT_HOST. The correct code is as follows:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// Please update the following macros to configure the IO expander //////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Set to 0 if not using IO Expander */
#define ESP_PANEL_USE_EXPANDER          (1)         // 0/1
#if ESP_PANEL_US
8000
E_EXPANDER
/**
 * IO expander name.
 */
#define ESP_PANEL_EXPANDER_NAME         CH422G

/* IO expander Settings */
/**
 * If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance.
 * It is useful if other devices use the same host. Please ensure that the host is initialized only once.
 */
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST       (1)     // 0/1
/* IO expander parameters */
#define ESP_PANEL_EXPANDER_HOST_ID                  (0)     // Typically set to 0
#define ESP_PANEL_EXPANDER_I2C_ADDRESS          (0x24)
#if !ESP_PANEL_EXPANDER_SKIP_INIT_HOST
    #define ESP_PANEL_EXPANDER_I2C_CLK_HZ       (400 * 1000)
                                                        // Typically set to 400K
    #define ESP_PANEL_EXPANDER_I2C_SCL_PULLUP   (0)     // 0/1
    #define ESP_PANEL_EXPANDER_I2C_SDA_PULLUP   (0)     // 0/1
    #define ESP_PANEL_EXPANDER_I2C_IO_SCL       (18)
    #define ESP_PANEL_EXPANDER_I2C_IO_SDA       (8)
#endif
#endif /* ESP_PANEL_USE_EXPANDER */

The issue has been fixed in the new commit. Thank you for testing it!

@Lzw655 Lzw655 force-pushed the bugfix/fix_LVGL_PORT_ROTATION_DEGREE_issue branch from 84c0e7d to 9293114 Compare July 30, 2024 02:51
@lboue
Copy link
Contributor
lboue commented Jul 30, 2024

The issue has been fixed in the new commit. Thank you for testing it!

@Lzw655 I have just redone a test against the latest branch commit and it now works with Waveshare_ESP32_S3_Touch_LCD_4_. I think we can validate this PR. This will make testing easier before releasing the new version.

I noticed a warning but GT911TC works well:
W (157) GT911: Unable to initialize the I2C address

Serial log

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x508
load:0x403c9700,len:0x4
load:0x403c9704,len:0xad0
load:0x403cc700,len:0x29e4
entry 0x403c9880
Squareline WiFi clock example start
Initialize panel device
D (67) ESP_Panel: Panel init start
D (67) ESP_Panel: Use LCD
D (67) ESP_Panel: Use RGB bus
D (68) ESP_Panel: Create LCD bus
D (69) ESP_Panel: Create LCD device
D (72) ESP_Panel: Use touch
D (75) ESP_Panel: Use I2C bus
D (77) ESP_PanelHost: Add host I2C[0]
D (81) ESP_Panel: Create touch bus
D (84) ESP_Panel: Create touch device
D (87) ESP_Panel: Use IO expander
D (90) ESP_Panel: Initialize host
D (94) ESP_PanelHost: Initialize host I2C[0]
D (97) ESP_Panel: Panel init end
D (100) ESP_PanelHost: Destroyed
D (103) ESP_Panel: Panel begin start
D (107) ESP_Panel: Begin IO expander
D (110) ESP_Panel: Begin LCD
D (135) ST7262_CPP: LCD panel @0x3fca8d3c created
D (136) ESP_PanelLcd: Begin start
D (136) ESP_PanelLcd: Begin end
D (136) ESP_Panel: Begin touch
D (137) ESP_PanelBus_I2C: Panel IO @0x3fcaa994 created
D (142) ESP_PanelTouch: Disable interruption
D (146) GT911_CPP: Use default GT911 driver data(address: 0x5d)
I (152) GT911: LCD touch panel create success, version: 1.1.1
W (157) GT911: Unable to initialize the I2C address
I (163) GT911: TouchPad_ID:0x39,0x31,0x31
I (166) GT911: TouchPad_Config_Version:67
D (169) ESP_Panel: Panel begin end
Initialize LVGL
Create UI
wifi_connected_flag: false
                          Squareline WiFi clock example end
D (102306) ESP_PanelTouch: Touch panel @0x3c34018c touched (533, 151, 59)
D (102336) ESP_PanelTouch: Touch panel @0x3c34018c touched (533, 151, 59)
D (102366) ESP_PanelTouch: Touch panel @0x3c34018c touched (533, 151, 59)
D (141621) ESP_PanelTouch: Touch panel @0x3c34018c touched (636, 170, 57)
D (141651) ESP_PanelTouch: Touch panel @0x3c34018c touched (636, 170, 57)
D (141681) ESP_PanelTouch: Touch panel @0x3c34018c touched (636, 170, 57)
D (141711) ESP_PanelTouch: Touch panel @0x3c34018c touched (636, 170, 57)
D (141741) ESP_PanelTouch: Touch panel @0x3c34018c touched (636, 170, 57)
D (141862) ESP_PanelTouch: Touch panel @0x3c34018c touched (633, 182, 58)
D (141892) ESP_PanelTouch: Touch panel @0x3c34018c touched (633, 182, 58)
D (141922) ESP_PanelTouch: Touch panel @0x3c34018c touched (633, 182, 58)
D (142013) ESP_PanelTouch: Touch panel @0x3c34018c touched (606, 249, 61)
D (142043) ESP_PanelTouch: Touch panel @0x3c34018c touched (606, 249, 61)
D (142073) ESP_PanelTouch: Touch panel @0x3c34018c touched (606, 249, 61)
D (144299) ESP_PanelTouch: Touch panel @0x3c34018c touched (410, 411, 50)
D (144329) ESP_PanelTouch: Touch panel @0x3c34018c touched (410, 411, 50)
D (144359) ESP_PanelTouch: Touch panel @0x3c34018c touched (410, 411, 50)

GT911 config

#define ESP_PANEL_USE_TOUCH         (1)         // 0/1
#if ESP_PANEL_USE_TOUCH
/**
 * Touch controller name
 */
#define ESP_PANEL_TOUCH_NAME        GT911

/* Touch resolution in pixels */
#define ESP_PANEL_TOUCH_H_RES       (ESP_PANEL_LCD_WIDTH)   // Typically set to the same value as the width of LCD
#define ESP_PANEL_TOUCH_V_RES       (ESP_PANEL_LCD_HEIGHT)  // Typically set to the same value as the height of LCD

/* Touch Panel Bus Settings */
/**
 * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance.
 * It is useful if other devices use the same host. Please ensure that the host is initialized only once.
 */
#define ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST      (0)     // 0/1
/**
 * Touch panel bus type
 */
#define ESP_PANEL_TOUCH_BUS_TYPE            (ESP_PANEL_BUS_TYPE_I2C)
/* Touch panel bus parameters */
#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C

    #define ESP_PANEL_TOUCH_BUS_HOST_ID     (0)     // Typically set to 0
    #define ESP_PANEL_TOUCH_I2C_ADDRESS     (0x14)  // For GT911, there are two addresses: 0x5D(default) and 0x14
#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST
    #define ESP_PANEL_TOUCH_I2C_CLK_HZ      (400 * 1000)
                                                    // Typically set to 400K
    #define ESP_PANEL_TOUCH_I2C_SCL_PULLUP  (1)     // 0/1
    #define ESP_PANEL_TOUCH_I2C_SDA_PULLUP  (1)     // 0/1
    #define ESP_PANEL_TOUCH_I2C_IO_SCL      (9)
    #define ESP_PANEL_TOUCH_I2C_IO_SDA      (8)
#endif

@Lzw655
Copy link
Collaborator Author
Lzw655 commented Jul 30, 2024

@lboue Thank you for your thorough testing. Since the GT911 can set the I2C address using the RST and INT pins, this warning appears if these two pins are not set in the driver. There's no need to worry about it. I'll go ahead and merge this PR.

@Lzw655 Lzw655 merged commit 13bbe76 into master Jul 30, 2024
3 checks passed
@Lzw655 Lzw655 deleted the bugfix/fix_LVGL_PORT_ROTATION_DEGREE_issue branch July 30, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants
0