From 3ee94a6af8717058ca875befdcae4d5395871ec6 Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Tue, 17 Feb 2026 23:05:40 -0500 Subject: [PATCH] [esp32_touch] Remove channel 8/9 BITS_SWAP workaround The fix is already in the ESP-IDF release/v5.5 branch (merged Dec 3, 2025) and will be in v5.5.3. Co-Authored-By: Claude Opus 4.6 --- .../components/esp32_touch/esp32_touch.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/esphome/components/esp32_touch/esp32_touch.cpp b/esphome/components/esp32_touch/esp32_touch.cpp index c866dddb007..8cc0298e67b 100644 --- a/esphome/components/esp32_touch/esp32_touch.cpp +++ b/esphome/components/esp32_touch/esp32_touch.cpp @@ -7,12 +7,6 @@ #include -#if defined(USE_ESP32_VARIANT_ESP32) && ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5, 5, 2) -// Workaround for ESP-IDF bug: touch_ll_enable_channel_mask() doesn't apply the -// channel 8/9 bit swap. Fixed in ESP-IDF v5.5.3 via MR !43531. -#include -#endif - namespace esphome::esp32_touch { static const char *const TAG = "esp32_touch"; @@ -209,19 +203,6 @@ void ESP32TouchComponent::setup() { return; } -#if defined(USE_ESP32_VARIANT_ESP32) && ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5, 5, 2) - // Workaround for ESP-IDF bug: touch_ll_enable_channel_mask() doesn't apply the - // bit swap for channels 8 and 9. The ESP32 hardware has these two channels - // physically swapped in the SENS peripheral registers. The legacy API applied - // TOUCH_LL_BITS_SWAP() but the new unified API omits it, causing channels 8 - // (GPIO33) and 9 (GPIO32) to not be enabled for measurement (reads return zero). - // Fixed in ESP-IDF v5.5.3 via MR !43531. - { - uint16_t worken = SENS.sar_touch_enable.touch_pad_worken; - SENS.sar_touch_enable.touch_pad_worken = TOUCH_LL_BITS_SWAP(worken); - } -#endif - // Do initial oneshot scans to populate baseline values for (int i = 0; i < 3; i++) { touch_sensor_trigger_oneshot_scanning(this->sens_handle_, 2000);