Skip to content

Commit 8b85130

Browse files
committed
Merge branch 'feat/touch_button_sensor_esp32' into 'master'
feat(touch_button_sensor): support esp32 and idf4.4 See merge request ae_group/esp-iot-solution!1258
2 parents b89da1c + e80f42a commit 8b85130

File tree

24 files changed

+387
-258
lines changed

24 files changed

+387
-258
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,6 @@ XUNIT_RESULT.xml
117117
#launchpad
118118
binaries/
119119
output.json
120+
121+
#components cache
122+
**/dist/

.gitlab/ci/build.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,15 +707,17 @@ build_example_sensors_sensor_hub_monitor:
707707
variables:
708708
EXAMPLE_DIR: examples/sensors/sensor_hub_monitor
709709

710-
build_example_touch_button:
710+
build_example_touch_button_sensor:
711711
extends:
712712
- .build_examples_template
713-
- .rules:build:example_touch_touch_button
713+
- .rules:build:example_touch_touch_button_sensor
714714
parallel:
715715
matrix:
716-
- IMAGE: espressif/idf:release-v5.3
716+
- IMAGE: espressif/idf:release-v4.4
717+
- IMAGE: espressif/idf:release-v5.1
718+
- IMAGE: espressif/idf:release-v5.4
717719
variables:
718-
EXAMPLE_DIR: examples/touch/touch_button
720+
EXAMPLE_DIR: examples/touch/touch_button_sensor
719721

720722
build_example_touch_touch_proximity:
721723
extends:
@@ -1498,6 +1500,7 @@ build_components_touch_touch_button_sensor_test_apps:
14981500
- .rules:build:components_touch_touch_button_sensor_test_apps
14991501
parallel:
15001502
matrix:
1503+
- IMAGE: espressif/idf:release-v5.1
15011504
- IMAGE: espressif/idf:release-v5.3
15021505
variables:
15031506
EXAMPLE_DIR: components/touch/touch_button_sensor/test_apps

.gitlab/ci/rules.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@
546546
- "examples/usb/device/usb_dongle/**/*"
547547

548548
.patterns-example_touch_touch_button: &patterns-example_touch_touch_button
549-
- "examples/touch/touch_button/**/*"
549+
- "examples/touch/touch_button_sensor/**/*"
550550

551551
.patterns-example_touch_touch_proximity: &patterns-example_touch_touch_proximity
552552
- "examples/touch/touch_proximity/**/*"
@@ -1293,7 +1293,7 @@
12931293
- <<: *if-dev-push
12941294
changes: *patterns-example_sensors_sensor_hub_monitor
12951295

1296-
.rules:build:example_touch_touch_button:
1296+
.rules:build:example_touch_touch_button_sensor:
12971297
rules:
12981298
- <<: *if-protected
12991299
- <<: *if-label-build

.gitlab/ci/target_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ components_test_touch_button_sensor:
119119
parallel:
120120
matrix:
121121
- IDF_VERSION: ["5.3"]
122-
IDF_TARGET: ["esp32s3", "esp32s2", "esp32p4"]
122+
IDF_TARGET: ["esp32", "esp32s3", "esp32s2", "esp32p4"]
123123
ENV_TAG: "generic"
124124
tags:
125125
- ${IDF_TARGET}

components/.build-rules.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ components/avi_player/test_apps:
1414

1515
components/touch/touch_button_sensor/test_apps:
1616
enable:
17-
- if: IDF_TARGET in ["esp32s2", "esp32s3", "esp32p4"]
17+
- if: IDF_TARGET in ["esp32", "esp32s2", "esp32s3"] and (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 1)
18+
- if: IDF_TARGET in ["esp32", "esp32s2", "esp32s3", "esp32p4"] and (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 3)
1819

1920
components/touch/touch_proximity_sensor/test_apps:
2021
enable:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# ChangeLog
22

3+
## v0.2.1 - 2025-03-28
4+
5+
* update touch_sensor_fsm to 0.7.0
6+
* improve default configuration for different targets
7+
8+
## v0.2.0 - 2025-03-25
9+
10+
* Using new touch touch_sensor_fsm 0.6.*
11+
312
## v0.1.0 - 2025-03-12
413

514
* Add Initial version
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
idf_component_register(SRC_DIRS "."
22
INCLUDE_DIRS "include")
33

4-
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/touch_button_sensor.c")
5-
add_prebuilt_library(touch_button_sensor_lib "${CMAKE_CURRENT_SOURCE_DIR}/${CONFIG_IDF_TARGET}/libtouch_button_sensor.a")
6-
target_include_directories(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
7-
target_link_libraries(${COMPONENT_LIB} INTERFACE touch_button_sensor_lib)
8-
else()
9-
include(package_manager)
10-
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})
11-
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-type-limits)
12-
endif()
4+
include(package_manager)
5+
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})
6+
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-type-limits)

components/touch/touch_button_sensor/Kconfig

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,51 @@ menu "Touch Button Sensor Configuration"
66
help
77
Enable touch button sensor debug mode.
88

9+
config TOUCH_BUTTON_SENSOR_CALIBRATION_TIMES
10+
int "Calibration times"
11+
default 50 if !IDF_TARGET_ESP32
12+
default 20
13+
range 10 1000
14+
help
15+
Number of readings used for initial calibration.
16+
17+
config TOUCH_BUTTON_SENSOR_DEBOUNCE_INACTIVE
18+
int "Debounce inactive count"
19+
default 3 if !IDF_TARGET_ESP32
20+
default 1
21+
range 1 50
22+
help
23+
Number of consecutive readings below threshold needed to confirm inactive state.
24+
25+
config TOUCH_BUTTON_SENSOR_POLLING_INTERVAL
26+
int "Polling interval (ms)"
27+
default 10
28+
range 5 100
29+
depends on IDF_TARGET_ESP32
30+
help
31+
Interval between polling touch readings in milliseconds (for ESP32 only).
32+
933
config TOUCH_BUTTON_SENSOR_SMOOTH_COEF_X1000
1034
int "Smooth coefficient (/1000)"
11-
default 200
35+
default 200 if IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32S2
36+
default 300 if IDF_TARGET_ESP32
37+
default 600 if IDF_TARGET_ESP32P4
38+
default 500
1239
range 0 1000
1340
help
1441
Coefficient for smooth filter, multiplied by 1000.
1542
For example, 200 means 0.2
1643

1744
config TOUCH_BUTTON_SENSOR_BASELINE_COEF_X1000
1845
int "Baseline coefficient (/1000)"
19-
default 5
46+
default 100 if IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32S2
47+
default 150 if IDF_TARGET_ESP32
48+
default 200 if IDF_TARGET_ESP32P4
49+
default 100
2050
range 0 1000
2151
help
2252
Coefficient for baseline filter, multiplied by 1000.
23-
For example, 5 means 0.005
53+
For example, 100 means 0.1
2454

2555
config TOUCH_BUTTON_SENSOR_MAX_P_X1000
2656
int "Maximum positive change ratio (/1000)"
@@ -46,42 +76,45 @@ menu "Touch Button Sensor Configuration"
4676

4777
config TOUCH_BUTTON_SENSOR_NOISE_P_SNR
4878
int "Positive noise SNR"
49-
default 10
50-
range 2 100
79+
default 4
80+
range 3 100
5181
help
5282
Signal-to-noise for positive Noise
5383

5484
config TOUCH_BUTTON_SENSOR_NOISE_N_SNR
5585
int "Negative noise SNR"
56-
default 5
86+
default 4
5787
range 2 100
5888
help
5989
Signal-to-noise for negative Noise
6090

61-
config TOUCH_BUTTON_SENSOR_RESET_P
62-
int "Reset positive count"
63-
default 1000
91+
config TOUCH_BUTTON_SENSOR_RESET_COVER
92+
int "Reset count from cover"
93+
default 1000 if !IDF_TARGET_ESP32
94+
default 300
6495
range 0 5000
6596
help
66-
Reset count for positive threshold. 0 means no reset.
97+
Reset count if cover is detected. 0 means no reset.
6798

68-
config TOUCH_BUTTON_SENSOR_RESET_N
69-
int "Reset negative count"
70-
default 30
71-
range 0 5000
99+
config TOUCH_BUTTON_SENSOR_RESET_CALIBRATION
100+
int "Reset count from calibration error"
101+
default 3
102+
range 0 100
72103
help
73104
Reset count for negative threshold. 0 means no reset.
74105

75106
config TOUCH_BUTTON_SENSOR_RAW_BUF_SIZE
76107
int "Raw buffer size"
77-
default 20
108+
default 40 if !IDF_TARGET_ESP32
109+
default 10
78110
range 10 100
79111
help
80112
Size of raw data buffer.
81113

82114
config TOUCH_BUTTON_SENSOR_SCALE_FACTOR
83115
int "Scale factor"
84-
default 100
116+
default 100 if !IDF_TARGET_ESP32
117+
default 1000
85118
range 10 1000
86119
help
87120
Scale factor for threshold calculation.

components/touch/touch_button_sensor/idf_component.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
version: "0.1.0"
1+
version: "0.2.1"
22
targets:
3+
- esp32
34
- esp32s2
45
- esp32s3
56
- esp32p4
@@ -9,12 +10,12 @@ url: https://github.com/espressif/esp-iot-solution/tree/master/components/touch/
910
repository: https://github.com/espressif/esp-iot-solution.git
1011
issues: https://github.com/espressif/esp-iot-solution/issues
1112
dependencies:
12-
idf: ">=5.3" #only 5.3 version library is provided
13+
idf: ">=4.4"
1314
cmake_utilities: "0.*"
1415
touch_sensor_fsm:
15-
version: "0.5.*"
16+
version: ">=0.7.0"
1617
touch_sensor_lowlevel:
17-
version: ">=0.6.0"
18+
version: ">=0.8.1"
1819
public: true
1920
files:
2021
exclude:

components/touch/touch_button_sensor/test_apps/main/idf_component.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
targets:
2+
- esp32
23
- esp32s2
34
- esp32s3
45
- esp32p4
56
- linux
67
dependencies:
7-
idf: ">=5.0"
8+
idf: ">=4.4"
89
cmake_utilities: "0.*"
910
touch_button_sensor:
1011
version: "*"

0 commit comments

Comments
 (0)