mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	cleanup
This commit is contained in:
		| @@ -296,7 +296,7 @@ void ESP32TouchComponent::loop() { | ||||
|  | ||||
|       // Find the child for the pad that triggered the interrupt | ||||
|       for (auto *child : this->children_) { | ||||
|         if (child->get_touch_pad() == event.pad) { | ||||
|         if (child->get_touch_pad() == event.pad an && d child->last_state_ != is_touch_event) { | ||||
|           // Read current value | ||||
|           uint32_t value = 0; | ||||
|           if (this->filter_configured_()) { | ||||
| @@ -305,13 +305,10 @@ void ESP32TouchComponent::loop() { | ||||
|             touch_pad_read_benchmark(event.pad, &value); | ||||
|           } | ||||
|  | ||||
|           // Update state if changed | ||||
|           if (child->last_state_ != is_touch_event) { | ||||
|             child->last_state_ = is_touch_event; | ||||
|             child->publish_state(is_touch_event); | ||||
|             ESP_LOGD(TAG, "Touch Pad '%s' %s (value: %d, threshold: %d)", child->get_name().c_str(), | ||||
|                      is_touch_event ? "touched" : "released", value, child->get_threshold()); | ||||
|           } | ||||
|           child->last_state_ = is_touch_event; | ||||
|           child->publish_state(is_touch_event); | ||||
|           ESP_LOGD(TAG, "Touch Pad '%s' %s (value: %d, threshold: %d)", child->get_name().c_str(), | ||||
|                    is_touch_event ? "touched" : "released", value, child->get_threshold()); | ||||
|           break; | ||||
|         } | ||||
|       } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user