touchscreen driver fixes (#6356)
This commit is contained in:
1 parent
f5b02056b9
commit
f264151537
2 files changed
+8
-7
No files matched your search
@@ -39,7 +39,6 @@ void Touchscreen::loop() {
|
||||
ESP_LOGVV(TAG, "<< Do Touch loop >>");
|
||||
this->first_touch_ = this->touches_.empty();
|
||||
this->need_update_ = false;
|
||||
this->was_touched_ = this->is_touched_;
|
||||
this->is_touched_ = false;
|
||||
this->skip_update_ = false;
|
||||
for (auto &tp : this->touches_) {
|
||||
@@ -62,7 +61,11 @@ void Touchscreen::loop() {
|
||||
if (this->touch_timeout_ > 0) {
|
||||
// Simulate a touch after <this->touch_timeout_> ms. This will reset any existing timeout operation.
|
||||
// This is to detect touch release.
|
||||
this->set_timeout(TAG, this->touch_timeout_, [this]() { this->store_.touched = true; });
|
||||
if (this->is_touched_) {
|
||||
this->set_timeout(TAG, this->touch_timeout_, [this]() { this->store_.touched = true; });
|
||||
} else {
|
||||
this->cancel_timeout(TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +114,7 @@ void Touchscreen::add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_r
|
||||
|
||||
void Touchscreen::send_touches_() {
|
||||
TouchPoints_t touches;
|
||||
ESP_LOGV(TAG, "Touch status: is_touched=%d, was_touched=%d", this->is_touched_, this->was_touched_);
|
||||
for (auto tp : this->touches_) {
|
||||
ESP_LOGV(TAG, "Touch status: %d/%d: raw:(%4d,%4d,%4d) calc:(%3d,%4d)", tp.second.id, tp.second.state,
|
||||
tp.second.x_raw, tp.second.y_raw, tp.second.z_raw, tp.second.x, tp.second.y);
|
||||
@@ -124,14 +128,10 @@ void Touchscreen::send_touches_() {
|
||||
}
|
||||
if (!this->is_touched_) {
|
||||
if (this->was_touched_) {
|
||||
if (this->touch_timeout_ > 0) {
|
||||
this->cancel_timeout(TAG);
|
||||
}
|
||||
this->release_trigger_.trigger();
|
||||
for (auto *listener : this->touch_listeners_)
|
||||
listener->release();
|
||||
this->touches_.clear();
|
||||
this->was_touched_ = false;
|
||||
}
|
||||
} else {
|
||||
if (this->first_touch_) {
|
||||
@@ -142,6 +142,7 @@ void Touchscreen::send_touches_() {
|
||||
}
|
||||
}
|
||||
}
|
||||
this->was_touched_ = this->is_touched_;
|
||||
}
|
||||
|
||||
int16_t Touchscreen::normalize_(int16_t val, int16_t min_val, int16_t max_val, bool inverted) {
|
||||
|
||||
Reference in new issue
Block a user