diff --git a/esphome/components/esp32_touch/esp32_touch_common.cpp b/esphome/components/esp32_touch/esp32_touch_common.cpp index fd2cdfcbad..a795f86e66 100644 --- a/esphome/components/esp32_touch/esp32_touch_common.cpp +++ b/esphome/components/esp32_touch/esp32_touch_common.cpp @@ -153,6 +153,14 @@ void ESP32TouchComponent::calculate_release_timeout_() { this->release_check_interval_ms_ = this->release_timeout_ms_ / 4; } +void ESP32TouchComponent::initialize_tracking_arrays_() { + // Initialize tracking arrays + for (size_t i = 0; i < TOUCH_PAD_MAX; i++) { + this->last_touch_time_[i] = 0; + this->initial_state_published_[i] = false; + } +} + } // namespace esp32_touch } // namespace esphome diff --git a/esphome/components/esp32_touch/esp32_touch_v2.cpp b/esphome/components/esp32_touch/esp32_touch_v2.cpp index 0b629203fb..1d0b30dfcb 100644 --- a/esphome/components/esp32_touch/esp32_touch_v2.cpp +++ b/esphome/components/esp32_touch/esp32_touch_v2.cpp @@ -137,16 +137,6 @@ void ESP32TouchComponent::setup() { // Calculate release timeout based on sleep cycle this->calculate_release_timeout_(); - - // Initialize tracking arrays - for (size_t i = 0; i < TOUCH_PAD_MAX; i++) { - this->last_touch_time_[i] = 0; - this->initial_state_published_[i] = false; - } - - // Mark initial states as not published yet (like v1) - // The actual initial state will be determined after release_timeout_ms_ in the loop - // This prevents false positives during startup when values may be unstable } void ESP32TouchComponent::dump_config() {