drivers: input: esp32: fix threshold calculation

Fix a bug in the touch threshold calculation where channel_num was
incorrectly used instead of channel_sens.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
Benjamin Cabé 2025-06-09 17:22:26 +02:00 committed by Dan Kalowsky
commit 67cfd32e04

View file

@ -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)