[esp32_touch] Work around ESP-IDF v5.4 regression in touch_pad_read_filtered()

This commit is contained in:
J. Nick Koston 2025-07-28 22:08:29 -10:00
parent ace375944c
commit e0e0a1a420
No known key found for this signature in database

View File

@ -201,15 +201,13 @@ void IRAM_ATTR ESP32TouchComponent::touch_isr_handler(void *arg) {
touch_pad_t pad = child->get_touch_pad();
// Read current value using ISR-safe API
uint32_t value;
if (component->iir_filter_enabled_()) {
uint16_t temp_value = 0;
touch_pad_read_filtered(pad, &temp_value);
value = temp_value;
} else {
// Use low-level HAL function when filter is not enabled
value = touch_ll_read_raw_data(pad);
}
// IMPORTANT: ESP-IDF v5.4 regression - touch_pad_read_filtered() is no longer ISR-safe
// In v5.3 and earlier it was ISR-safe, but v5.4 added mutex protection that causes:
// "assert failed: xQueueSemaphoreTake queue.c:1718"
// We must use raw values even when filter is enabled as a workaround.
// Users should adjust thresholds to compensate for the lack of IIR filtering.
// See: https://github.com/espressif/esp-idf/issues/17045
uint32_t value = touch_ll_read_raw_data(pad);
// Skip pads that arent in the trigger mask
if (((mask >> pad) & 1) == 0) {