mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	cleanup
This commit is contained in:
		| @@ -178,7 +178,9 @@ class ESP32TouchBinarySensor : public binary_sensor::BinarySensor { | ||||
|   touch_pad_t get_touch_pad() const { return this->touch_pad_; } | ||||
|   uint32_t get_threshold() const { return this->threshold_; } | ||||
|   void set_threshold(uint32_t threshold) { this->threshold_ = threshold; } | ||||
| #ifdef USE_ESP32_VARIANT_ESP32 | ||||
|   uint32_t get_value() const { return this->value_; } | ||||
| #endif | ||||
|   uint32_t get_wakeup_threshold() const { return this->wakeup_threshold_; } | ||||
|  | ||||
|  protected: | ||||
| @@ -186,7 +188,9 @@ class ESP32TouchBinarySensor : public binary_sensor::BinarySensor { | ||||
|  | ||||
|   touch_pad_t touch_pad_{TOUCH_PAD_MAX}; | ||||
|   uint32_t threshold_{0}; | ||||
| #ifdef USE_ESP32_VARIANT_ESP32 | ||||
|   uint32_t value_{0}; | ||||
| #endif | ||||
|   bool last_state_{false}; | ||||
|   const uint32_t wakeup_threshold_{0}; | ||||
| }; | ||||
|   | ||||
| @@ -270,8 +270,6 @@ void ESP32TouchComponent::loop() { | ||||
|         touch_pad_read_benchmark(child->get_touch_pad(), &value); | ||||
|       } | ||||
|  | ||||
|       child->value_ = value; | ||||
|  | ||||
|       // For S2/S3 v2, higher value means touched (opposite of v1) | ||||
|       bool is_touched = value > child->get_threshold(); | ||||
|       child->last_state_ = is_touched; | ||||
| @@ -307,8 +305,6 @@ void ESP32TouchComponent::loop() { | ||||
|             touch_pad_read_benchmark(event.pad, &value); | ||||
|           } | ||||
|  | ||||
|           child->value_ = value; | ||||
|  | ||||
|           // Update state if changed | ||||
|           if (child->last_state_ != is_touch_event) { | ||||
|             child->last_state_ = is_touch_event; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user