diff --git a/esphome/components/esp32_touch/esp32_touch_v2.cpp b/esphome/components/esp32_touch/esp32_touch_v2.cpp index f0737a6cec..8ac21676d0 100644 --- a/esphome/components/esp32_touch/esp32_touch_v2.cpp +++ b/esphome/components/esp32_touch/esp32_touch_v2.cpp @@ -242,6 +242,17 @@ void ESP32TouchComponent::dump_config() { void ESP32TouchComponent::loop() { const uint32_t now = App.get_loop_component_start_time(); + // In setup mode, periodically log all pad values + if (this->setup_mode_ && now - this->setup_mode_last_log_print_ > SETUP_MODE_LOG_INTERVAL_MS) { + for (auto *child : this->children_) { + // Read the value being used for touch detection + uint32_t value = this->read_touch_value(child->get_touch_pad()); + + ESP_LOGD(TAG, "Touch Pad '%s' (T%d): %d", child->get_name().c_str(), child->get_touch_pad(), value); + } + this->setup_mode_last_log_print_ = now; + } + // Process any queued touch events from interrupts TouchPadEventV2 event; while (xQueueReceive(this->touch_queue_, &event, 0) == pdTRUE) { @@ -281,17 +292,6 @@ void ESP32TouchComponent::loop() { break; } } - - // In setup mode, periodically log all pad values - if (this->setup_mode_ && now - this->setup_mode_last_log_print_ > SETUP_MODE_LOG_INTERVAL_MS) { - for (auto *child : this->children_) { - // Read the value being used for touch detection - uint32_t value = this->read_touch_value(child->get_touch_pad()); - - ESP_LOGD(TAG, "Touch Pad '%s' (T%d): %d", child->get_name().c_str(), child->get_touch_pad(), value); - } - this->setup_mode_last_log_print_ = now; - } } void ESP32TouchComponent::on_shutdown() {