Skip to content

Commit 9436426

Browse files
committed
fix(panel): remove redundant code
1 parent 77167a2 commit 9436426

File tree

14 files changed

+48
-74
lines changed

14 files changed

+48
-74
lines changed

ESP_Panel_Board_Custom.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,11 @@
247247
/* Touch panel bus parameters */
248248
#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C
249249

250-
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0 to use the default address
251-
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // For GT911, there are two addresses: 0x5D(default) and 0x14
250+
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0
251+
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address.
252+
// - For touchs with only one address, set to 0
253+
// - For touchs with multiple addresses, set to 0 or the address
254+
// Like GT911, there are two addresses: 0x5D(default) and 0x14
252255
#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST
253256
#define ESP_PANEL_TOUCH_I2C_CLK_HZ (400 * 1000)
254257
// Typically set to 400K
@@ -372,7 +375,7 @@
372375
*/
373376
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
374377
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
375-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3
378+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 4
376379

377380
#endif /* ESP_PANEL_USE_CUSTOM_BOARD */
378381

examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,11 @@
247247
/* Touch panel bus parameters */
248248
#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C
249249

250-
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0 to use the default address
251-
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // For GT911, there are two addresses: 0x5D(default) and 0x14
250+
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0
251+
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address.
252+
// - For touchs with only one address, set to 0
253+
// - For touchs with multiple addresses, set to 0 or the address
254+
// Like GT911, there are two addresses: 0x5D(default) and 0x14
252255
#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST
253256
#define ESP_PANEL_TOUCH_I2C_CLK_HZ (400 * 1000)
254257
// Typically set to 400K
@@ -372,7 +375,7 @@
372375
*/
373376
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
374377
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
375-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3
378+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 4
376379

377380
#endif /* ESP_PANEL_USE_CUSTOM_BOARD */
378381

examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,11 @@
247247
/* Touch panel bus parameters */
248248
#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C
249249

250-
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0 to use the default address
251-
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // For GT911, there are two addresses: 0x5D(default) and 0x14
250+
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0
251+
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address.
252+
// - For touchs with only one address, set to 0
253+
// - For touchs with multiple addresses, set to 0 or the address
254+
// Like GT911, there are two addresses: 0x5D(default) and 0x14
252255
#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST
253256
#define ESP_PANEL_TOUCH_I2C_CLK_HZ (400 * 1000)
254257
// Typically set to 400K
@@ -372,7 +375,7 @@
372375
*/
373376
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
374377
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
375-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3
378+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 4
376379

377380
#endif /* ESP_PANEL_USE_CUSTOM_BOARD */
378381

examples/Panel/PanelTest/ESP_Panel_Board_Custom.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,11 @@
247247
/* Touch panel bus parameters */
248248
#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C
249249

250-
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0 to use the default address
251-
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // For GT911, there are two addresses: 0x5D(default) and 0x14
250+
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0
251+
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address.
252+
// - For touchs with only one address, set to 0
253+
// - For touchs with multiple addresses, set to 0 or the address
254+
// Like GT911, there are two addresses: 0x5D(default) and 0x14
252255
#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST
253256
#define ESP_PANEL_TOUCH_I2C_CLK_HZ (400 * 1000)
254257
// Typically set to 400K
@@ -372,7 +375,7 @@
372375
*/
373376
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
374377
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
375-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3
378+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 4
376379

377380
#endif /* ESP_PANEL_USE_CUSTOM_BOARD */
378381

examples/PlatformIO/src/ESP_Panel_Board_Custom.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,11 @@
247247
/* Touch panel bus parameters */
248248
#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C
249249

250-
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0 to use the default address
251-
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // For GT911, there are two addresses: 0x5D(default) and 0x14
250+
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0
251+
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address.
252+
// - For touchs with only one address, set to 0
253+
// - For touchs with multiple addresses, set to 0 or the address
254+
// Like GT911, there are two addresses: 0x5D(default) and 0x14
252255
#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST
253256
#define ESP_PANEL_TOUCH_I2C_CLK_HZ (400 * 1000)
254257
// Typically set to 400K
@@ -372,7 +375,7 @@
372375
*/
373376
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
374377
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
375-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3
378+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 4
376379

377380
#endif /* ESP_PANEL_USE_CUSTOM_BOARD */
378381

examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,11 @@
247247
/* Touch panel bus parameters */
248248
#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C
249249

250-
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0 to use the default address
251-
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // For GT911, there are two addresses: 0x5D(default) and 0x14
250+
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0
251+
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address.
252+
// - For touchs with only one address, set to 0
253+
// - For touchs with multiple addresses, set to 0 or the address
254+
// Like GT911, there are two addresses: 0x5D(default) and 0x14
252255
#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST
253256
#define ESP_PANEL_TOUCH_I2C_CLK_HZ (400 * 1000)
254257
// Typically set to 400K
@@ -372,7 +375,7 @@
372375
*/
373376
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
374377
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
375-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3
378+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 4
376379

377380
#endif /* ESP_PANEL_USE_CUSTOM_BOARD */
378381

examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,11 @@
247247
/* Touch panel bus parameters */
248248
#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C
249249

250-
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0 to use the default address
251-
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // For GT911, there are two addresses: 0x5D(default) and 0x14
250+
#define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0
251+
#define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address.
252+
// - For touchs with only one address, set to 0
253+
// - For touchs with multiple addresses, set to 0 or the address
254+
// Like GT911, there are two addresses: 0x5D(default) and 0x14
252255
#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST
253256
#define ESP_PANEL_TOUCH_I2C_CLK_HZ (400 * 1000)
254257
// Typically set to 400K
@@ -372,7 +375,7 @@
372375
*/
373376
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
374377
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
375-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3
378+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 4
376379

377380
#endif /* ESP_PANEL_USE_CUSTOM_BOARD */
378381

examples/Touch/I2C/I2C.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@
5353
* - ST1633, ST7123
5454
*/
5555
#define EXAMPLE_TOUCH_NAME GT911
56-
#define EXAMPLE_TOUCH_ADDRESS (0) // Typically set to `0` to use the default address
57-
// For GT911, there are two addresses: 0x5D(default) and 0x14
56+
#define EXAMPLE_TOUCH_ADDRESS (0) // Typically set to 0 to use the default address.
57+
// - For touchs with only one address, set to 0
58+
// - For touchs with multiple addresses, set to 0 or the address
59+
// Like GT911, there are two addresses: 0x5D(default) and 0x14
5860
#define EXAMPLE_TOUCH_WIDTH (480)
5961
#define EXAMPLE_TOUCH_HEIGHT (480)
6062
#define EXAMPLE_TOUCH_I2C_FREQ_HZ (400 * 1000)

src/ESP_Panel.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ using namespace std;
4545
#define CREATE_LCD(name, bus, cfg) _CREATE_LCD(name, bus, cfg)
4646
#define _CREATE_TOUCH(name, bus, cfg) make_shared<ESP_PanelTouch_##name>(bus, cfg)
4747
#define CREATE_TOUCH(name, bus, cfg) _CREATE_TOUCH(name, bus, cfg)
48-
#define _CREATE_TOUCH_WITH_ADDR(name, bus, cfg, addr) make_shared<ESP_PanelTouch_##name>(bus, cfg, addr)
49-
#define CREATE_TOUCH_WITH_ADDR(name, bus, cfg, addr) _CREATE_TOUCH_WITH_ADDR(name, bus, cfg, addr)
5048
#define _CREATE_EXPANDER(name, host_id, address) make_shared<ESP_IOExpander_##name>(host_id, address)
5149
#define CREATE_EXPANDER(name, host_id, address) _CREATE_EXPANDER(name, host_id, address)
5250

@@ -414,12 +412,7 @@ bool ESP_Panel::init(void)
414412
ESP_PANEL_CHECK_NULL_RET(touch_bus_ptr, false, "Create touch bus failed");
415413

416414
ESP_LOGD(TAG, "Create touch device");
417-
touch_ptr =
418-
#if ESP_PANEL_TOUCH_I2C_ADDRESS == 0
419-
CREATE_TOUCH(ESP_PANEL_TOUCH_NAME, touch_bus_ptr.get(), lcd_touch_config);
420-
#else
421-
CREATE_TOUCH_WITH_ADDR(ESP_PANEL_TOUCH_NAME, touch_bus_ptr.get(), lcd_touch_config, ESP_PANEL_TOUCH_I2C_ADDRESS);
422-
#endif
415+
touch_ptr = CREATE_TOUCH(ESP_PANEL_TOUCH_NAME, touch_bus_ptr.get(), lcd_touch_config);
423416
ESP_PANEL_CHECK_NULL_RET(touch_ptr, false, "Create touch device failed");
424417
#endif /* ESP_PANEL_USE_TOUCH */
425418

src/ESP_PanelVersions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/* File `ESP_Panel_Board_Custom.h` */
2222
#define ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR 0
2323
#define ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR 1
24-
#define ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH 3
24+
#define ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH 4
2525

2626
/* File `ESP_Panel_Board_Supported.h` */
2727
#define ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR 0

0 commit comments

Comments
 (0)