From 67cfd32e04c78d73454b16adf427c0e76fb9d350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 9 Jun 2025 17:22:26 +0200 Subject: [PATCH] drivers: input: esp32: fix threshold calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a bug in the touch threshold calculation where channel_num was incorrectly used instead of channel_sens. Signed-off-by: Benjamin Cabé --- drivers/input/input_esp32_touch_sensor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/input_esp32_touch_sensor.c b/drivers/input/input_esp32_touch_sensor.c index 08fed50cc5a..4ec5597ff88 100644 --- a/drivers/input/input_esp32_touch_sensor.c +++ b/drivers/input/input_esp32_touch_sensor.c @@ -254,7 +254,7 @@ static int esp32_touch_sensor_init(const struct device *dev) uint16_t touch_value = touch_hal_read_raw_data(channel_cfg->channel_num); touch_hal_set_threshold(channel_cfg->channel_num, - touch_value * (100 - channel_cfg->channel_num) / 100); + touch_value * (100 - channel_cfg->channel_sens) / 100); } #elif defined(CONFIG_SOC_SERIES_ESP32S2) || defined(CONFIG_SOC_SERIES_ESP32S3)