mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
Merge branch 'testbranch' into dev
This commit is contained in:
commit
00e5df923e
4 changed files with 17 additions and 9 deletions
|
@ -23,6 +23,10 @@ void ICNT86Touchscreen::setup() {
|
|||
this->reset_pin_->setup();
|
||||
this->reset_();
|
||||
}
|
||||
|
||||
this->x_raw_max_ = this->display_->get_native_width();
|
||||
this->y_raw_max_ = this->display_->get_native_height();
|
||||
|
||||
this->conversion_to_resolution_ = false;
|
||||
// Trigger initial read to activate the interrupt
|
||||
this->store_.touched = true;
|
||||
|
@ -49,12 +53,12 @@ void ICNT86Touchscreen::update_touches() {
|
|||
UWORD y = ((UWORD) buf[4 + 7 * i] << 8) + buf[3 + 7 * i];
|
||||
UWORD p = buf[5 + 7 * i];
|
||||
UWORD touch_evenid = buf[6 + 7 * i];
|
||||
ESP_LOGD(TAG, "Touch x: %d, y: %d, p: %d", x, y, p);
|
||||
|
||||
if (this->touches_.count(touch_evenid) == 0 || (x != this->touches_[touch_evenid].x_prev && y != this->touches_[touch_evenid].y_prev)) {
|
||||
this->add_raw_touch_position_(touch_evenid, x, y, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ICNT86Touchscreen::reset_() {
|
||||
if (this->reset_pin_ != nullptr) {
|
||||
|
|
|
@ -20,7 +20,7 @@ ICNT86Touchscreen = icnt86_ns.class_(
|
|||
CONF_ICNT86_ID = "icnt86_id"
|
||||
CONF_RTS_PIN = "rts_pin"
|
||||
|
||||
CONFIG_SCHEMA = touchscreen.TOUCHSCREEN_SCHEMA.extend(
|
||||
CONFIG_SCHEMA = touchscreen.touchscreen_schema('250ms').extend(
|
||||
cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(ICNT86Touchscreen),
|
||||
|
|
|
@ -97,6 +97,9 @@ void Touchscreen::add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_r
|
|||
if (this->conversion_to_resolution_) {
|
||||
tp.x = (uint16_t) ((int) x * this->display_width_ / 0x1000);
|
||||
tp.y = (uint16_t) ((int) y * this->display_height_ / 0x1000);
|
||||
} else {
|
||||
tp.x = (uint16_t) (int) x;
|
||||
tp.y = (uint16_t) (int) y;
|
||||
}
|
||||
} else {
|
||||
tp.state |= STATE_CALIBRATE;
|
||||
|
@ -106,11 +109,12 @@ void Touchscreen::add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_r
|
|||
tp.y_org = tp.y;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Touch info, x_raw: %d, y_raw: %d, p: %d, x: %d, y: %d", x_raw, y_raw, z_raw, tp.x, tp.y);
|
||||
ESP_LOGD(TAG, "Touch info, x_raw: %d, y_raw: %d, p: %d, x: %d, y: %d, x_prev: %d, y_prev: %d", x_raw, y_raw, z_raw, tp.x, tp.y,tp.x_prev, tp.y_prev );
|
||||
|
||||
this->touches_[id] = tp;
|
||||
|
||||
this->is_touched_ = true;
|
||||
|
||||
if ((tp.x != tp.x_prev) || (tp.y != tp.y_prev)) {
|
||||
this->need_update_ = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue