Skip to content

Commit a96387b

Browse files
committed
fix(panel): remove redundant code
1 parent 80809e4 commit a96387b

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

src/touch/ESP_PanelTouch.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,6 @@ ESP_PanelTouch::ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &
7878
}
7979
}
8080

81-
ESP_PanelTouch::ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config, int address):
82-
bus(bus),
83-
config(config),
84-
handle(NULL),
85-
_swap_xy(false),
86-
_mirror_x(false),
87-
_mirror_y(false),
88-
_tp_points_num(0),
89-
_tp_buttons_state{0},
90-
onTouchInterruptCallback(NULL),
91-
_isr_sem(NULL),
92-
callback_data(CALLBACK_DATA_DEFAULT())
93-
{
94-
if ((config.int_gpio_num != GPIO_NUM_NC) && (config.interrupt_callback == NULL) && (config.user_data == NULL)) {
95-
this->config.interrupt_callback = onTouchInterrupt;
96-
this->config.user_data = &callback_data;
97-
}
98-
}
99-
10081
bool ESP_PanelTouch::attachInterruptCallback(std::function<bool (void *)> callback, void *user_data)
10182
{
10283
ESP_PANEL_CHECK_FALSE_RET((config.interrupt_callback == onTouchInterrupt), false, "Interruption is not enabled");

src/touch/ESP_PanelTouch.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ class ESP_PanelTouch {
7878
*/
7979
ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config);
8080

81-
/**
82-
* @brief Construct a new touch device in a complex way, the `init()` function should be called after this function
83-
*
84-
* @param bus Pointer to panel bus
85-
* @param config Touch device configuration
86-
* @param address The address of the touch device, default set to `0` to use the default address
87-
*/
88-
ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config, int address);
89-
9081
/**
9182
* @brief Destroy the LCD device
9283
*

src/touch/GT911.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ ESP_PanelTouch_GT911::ESP_PanelTouch_GT911(ESP_PanelBus *bus, const esp_lcd_touc
1919
{
2020
}
2121

22-
ESP_PanelTouch_GT911::ESP_PanelTouch_GT911(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config, int address):
23-
ESP_PanelTouch(bus, config, address)
24-
{
25-
}
26-
2722
ESP_PanelTouch_GT911::~ESP_PanelTouch_GT911()
2823
{
2924
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();

src/touch/GT911.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ class ESP_PanelTouch_GT911 : public ESP_PanelTouch {
3636
*/
3737
ESP_PanelTouch_GT911(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config);
3838

39-
/**
40-
* @brief Construct a new touch device in a complex way, the `init()` function should be called after this function
41-
*
42-
* @param bus Pointer to panel bus
43-
* @param config Touch device configuration
44-
* @param address The address of the touch device, default set to `0` to use the default address
45-
*/
46-
ESP_PanelTouch_GT911(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config, int address);
47-
4839
/**
4940
* @brief Destroy the LCD device
5041
*

0 commit comments

Comments
 (0)