mirror of
https://github.com/esphome/esphome.git
synced 2024-11-15 03:28:12 +01:00
avoid conversion to resolution
This commit is contained in:
parent
1c2801e1d3
commit
b13200f2af
3 changed files with 6 additions and 2 deletions
|
@ -23,6 +23,7 @@ void ICNT86Touchscreen::setup() {
|
||||||
this->reset_pin_->setup();
|
this->reset_pin_->setup();
|
||||||
this->reset_();
|
this->reset_();
|
||||||
}
|
}
|
||||||
|
this->conversion_to_resolution_ = false;
|
||||||
// Trigger initial read to activate the interrupt
|
// Trigger initial read to activate the interrupt
|
||||||
this->store_.touched = true;
|
this->store_.touched = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,10 @@ void Touchscreen::add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_r
|
||||||
std::swap(x, y);
|
std::swap(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->conversion_to_resolution_) {
|
||||||
tp.x = (uint16_t) ((int) x * this->display_width_ / 0x1000);
|
tp.x = (uint16_t) ((int) x * this->display_width_ / 0x1000);
|
||||||
tp.y = (uint16_t) ((int) y * this->display_height_ / 0x1000);
|
tp.y = (uint16_t) ((int) y * this->display_height_ / 0x1000);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tp.state |= STATE_CALIBRATE;
|
tp.state |= STATE_CALIBRATE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,7 @@ class Touchscreen : public PollingComponent {
|
||||||
bool is_touched_{false};
|
bool is_touched_{false};
|
||||||
bool was_touched_{false};
|
bool was_touched_{false};
|
||||||
bool skip_update_{false};
|
bool skip_update_{false};
|
||||||
|
bool conversion_to_resolution_{true};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace touchscreen
|
} // namespace touchscreen
|
||||||
|
|
Loading…
Reference in a new issue