Skip to content

fix(touch): avoid reading the button state when disabled #163

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
233 changes: 141 additions & 92 deletions .gitlab/ci/rules.yml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ChangeLog

## v1.0.1 - 2025-02-19

### Bugfixes:

* fix(touch): avoid reading the button state when disabled (#162)
* fix(docs): correct and add descriptions

## v1.0.0 - 2025-02-17

### Breaking changes:
Expand Down
12 changes: 7 additions & 5 deletions docs/envs/use_with_arduino.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@
- Open Arduino IDE
- Navigate to `File` > `Preferences`
- Add to `Additional boards manager URLs`:
```
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
```

```
https://espressif.github.io/arduino-esp32/package_esp32_index.json
```

- Navigate to `Tools` > `Board` > `Boards Manager`
- Search for `esp32` by `Espressif Systems` and install the required version (see [SDK & Dependencies](#sdk--dependencies))

Expand All @@ -65,7 +67,7 @@

1. **Select and Configure Board**

- Navigate to `Tools` > `Board` > `ESP32`
- Navigate to `Tools` > `Board` > `esp32`
- Select your board model. If you can't find a matching model, refer to:

- If using a [supported board](../../README.md#supported-boards), see [Configuring Arduino IDE](#configuring-arduino-ide)
Expand All @@ -74,7 +76,7 @@
2. **Open Example**

- Navigate to `File` > `Examples` > `ESP32_Display_Panel`
- Select `Board` > [`board_static_config`](../../examples/arduino/board/board_static_config/)
- Select `Arduino` > `board` > [`board_static_config`](../../examples/arduino/board/board_static_config/)

3. **Modify Code**

Expand Down
12 changes: 7 additions & 5 deletions docs/envs/use_with_arduino_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@
- 打开 Arduino IDE
- 导航到 `File` > `Preferences`
- 在 `Additional boards manager URLs` 中添加:
```
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
```

```
https://espressif.github.io/arduino-esp32/package_esp32_index.json
```

- 导航到 `Tools` > `Board` > `Boards Manager`
- 搜索 `esp32` by `Espressif Systems` 并安装符合要求的版本(参阅 [SDK 及依赖库](#sdk-及依赖库))

Expand All @@ -65,7 +67,7 @@

1. **选择和配置开发板**

- 导航到 `Tools` > `Board` > `ESP32`
- 导航到 `Tools` > `Board` > `esp32`
- 选择您的开发板型号。如果未找到匹配的型号,请参考以下信息:

* 如果您正在使用 [支持的开发板](../../README_CN.md#支持的开发板),可以参阅 [配置 Arduino IDE](#配置-arduino-ide)
Expand All @@ -74,7 +76,7 @@
2. **打开示例**

- 导航到 `File` > `Examples` > `ESP32_Display_Panel`
- 选择 `Board` > [`board_static_config`](../../examples/arduino/board/board_static_config/)
- 选择 `Arduino` > `board` > [`board_static_config`](../../examples/arduino/board/board_static_config/)

3. **修改代码**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ using namespace esp_panel::drivers;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Currently, the library supports the following RGB (without 3-wire SPI) LCDs:
* - ST7262
* - EK9716B
* - ST7262
*/
#define EXAMPLE_LCD_NAME ST7262
#define EXAMPLE_LCD_WIDTH (800)
Expand Down
3 changes: 2 additions & 1 deletion examples/platformio/lvgl_v8_port/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This example demonstrates how to port `LVGL v8`. And for `RGB/MIPI-DSI` interfac

- [Optional] `ESP32_Display_Panel`:

- This example already has the [esp_panel_drivers_conf.h](./src/esp_panel_drivers_conf.h) configuration file in the project directory. Edit this file as needed
- This example already has the [esp_panel_board_custom_conf.h](./src/esp_panel_board_custom_conf.h) and [esp_panel_drivers_conf.h](./src/esp_panel_drivers_conf.h) configuration files in the project directory. Edit these files as needed
- see [Board Configuration Guide](../../../docs/envs/use_with_arduino.md#configuration-guide) for more information

- [Optional] `esp-lib-utils` :
Expand Down Expand Up @@ -65,6 +65,7 @@ This example demonstrates how to port `LVGL v8`. And for `RGB/MIPI-DSI` interfac

- Modify the [BOARD_CUSTOM.json](./boards/BOARD_CUSTOM.json) board file by referring to a supported board file which has the same chip as your board.
- Modify the `[env:BOARD_CUSTOM]` board env in the *platformio.ini* file as needed
- Modify the *esp_panel_board_custom_conf.h* file and set `ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM` to `1`. Then change other configurations as needed in the file

- See [PlatformIO Docs](https://docs.platformio.org/en/latest/projectconf/index.html) for more information

Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "1.0.0"
version: "1.0.1"
description: ESP32_Display_Panel is a display driver and GUI porting library designed by Espressif specifically for ESP series SoCs (ESP32, ESP32-S3, ESP32-P4, etc.)
url: https://github.com/esp-arduino-libs/ESP32_Display_Panel
repository: https://github.com/esp-arduino-libs/ESP32_Display_Panel.git
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32_Display_Panel
version=1.0.0
version=1.0.1
author=espressif
maintainer=espressif
sentence=ESP32_Display_Panel is a display driver and GUI porting library designed by Espressif specifically for ESP series SoCs (ESP32, ESP32-S3, ESP32-P4, etc.)
Expand Down
7 changes: 5 additions & 2 deletions src/drivers/touch/esp_panel_touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,10 @@ bool Touch::readRawData(int points_num, int buttons_num, int timeout_ms)
// Get the points
ESP_UTILS_CHECK_FALSE_RETURN(readRawDataPoints(points_num), false, "Read points failed");

#if CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0
// Get the buttons
ESP_UTILS_CHECK_FALSE_RETURN(readRawDataButtons(buttons_num), false, "Read buttons failed");
#endif

ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS();

Expand Down Expand Up @@ -610,10 +612,10 @@ bool Touch::readRawDataButtons(int buttons_num)
}
// Limit the max buttons number
if (buttons_num > BUTTONS_MAX_NUM) {
buttons_num = BUTTONS_MAX_NUM;
ESP_UTILS_LOGW(
"The target buttons number(%d) out of range, use the max number(%d) instead", buttons_num, BUTTONS_MAX_NUM
);
buttons_num = BUTTONS_MAX_NUM;
}
if (buttons_num <= 0) {
ESP_UTILS_LOGD("Ignore to read buttons");
Expand All @@ -627,13 +629,14 @@ bool Touch::readRawDataButtons(int buttons_num)

for (int i = 0; i < buttons_num; i++) {
button_state = 0;
#if CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0
auto ret = esp_lcd_touch_get_button_state(touch_panel, i, &button_state);
if (ret == ESP_ERR_INVALID_ARG) {
ESP_UTILS_LOGD("Button(%d) is not supported", i);
break;
}
ESP_UTILS_CHECK_ERROR_RETURN(ret, false, "Get button(%d) state failed", i);

#endif
buttons.emplace_back(i, button_state);
}

Expand Down
2 changes: 1 addition & 1 deletion src/esp_panel_versions.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/* Library Version */
#define ESP_PANEL_VERSION_MAJOR 1
#define ESP_PANEL_VERSION_MINOR 0
#define ESP_PANEL_VERSION_PATCH 0
#define ESP_PANEL_VERSION_PATCH 1

/* File `esp_panel_drivers_conf.h` */
#define ESP_PANEL_DRIVERS_CONF_VERSION_MAJOR 1
Expand Down
Loading