mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	[touchscreen] Clear interrupt flag before reading touch data. (#8632)
This commit is contained in:
		| @@ -50,13 +50,15 @@ void Touchscreen::loop() { | |||||||
|       tp.second.x_prev = tp.second.x; |       tp.second.x_prev = tp.second.x; | ||||||
|       tp.second.y_prev = tp.second.y; |       tp.second.y_prev = tp.second.y; | ||||||
|     } |     } | ||||||
|  |     // The interrupt flag must be reset BEFORE calling update_touches, otherwise we might miss an interrupt that was | ||||||
|  |     // triggered while we were reading touch data. | ||||||
|  |     this->store_.touched = false; | ||||||
|     this->update_touches(); |     this->update_touches(); | ||||||
|     if (this->skip_update_) { |     if (this->skip_update_) { | ||||||
|       for (auto &tp : this->touches_) { |       for (auto &tp : this->touches_) { | ||||||
|         tp.second.state &= ~STATE_RELEASING; |         tp.second.state &= ~STATE_RELEASING; | ||||||
|       } |       } | ||||||
|     } else { |     } else { | ||||||
|       this->store_.touched = false; |  | ||||||
|       this->defer([this]() { this->send_touches_(); }); |       this->defer([this]() { this->send_touches_(); }); | ||||||
|       if (this->touch_timeout_ > 0) { |       if (this->touch_timeout_ > 0) { | ||||||
|         // Simulate a touch after <this->touch_timeout_> ms. This will reset any existing timeout operation. |         // Simulate a touch after <this->touch_timeout_> ms. This will reset any existing timeout operation. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user