mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 16:38:16 +01:00
rename set_raw_touch_position_ to add_raw_touch_position_ (#5962)
This commit is contained in:
parent
7b2b6aaeb1
commit
fbf3d03a33
9 changed files with 10 additions and 10 deletions
|
@ -74,7 +74,7 @@ void EKTF2232Touchscreen::update_touches() {
|
||||||
uint8_t *d = raw + 1 + (i * 3);
|
uint8_t *d = raw + 1 + (i * 3);
|
||||||
x_raw = (d[0] & 0xF0) << 4 | d[1];
|
x_raw = (d[0] & 0xF0) << 4 | d[1];
|
||||||
y_raw = (d[0] & 0x0F) << 8 | d[2];
|
y_raw = (d[0] & 0x0F) << 8 | d[2];
|
||||||
this->set_raw_touch_position_(i, x_raw, y_raw);
|
this->add_raw_touch_position_(i, x_raw, y_raw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ class FT5x06Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice
|
||||||
|
|
||||||
esph_log_d(TAG, "Read %X status, id: %d, pos %d/%d", status, id, x, y);
|
esph_log_d(TAG, "Read %X status, id: %d, pos %d/%d", status, id, x, y);
|
||||||
if (status == 0 || status == 2) {
|
if (status == 0 || status == 2) {
|
||||||
this->set_raw_touch_position_(id, x, y);
|
this->add_raw_touch_position_(id, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,13 +53,13 @@ void FT63X6Touchscreen::update_touches() {
|
||||||
uint8_t touch_id = this->read_touch_id_(FT63X6_ADDR_TOUCH1_ID); // id1 = 0 or 1
|
uint8_t touch_id = this->read_touch_id_(FT63X6_ADDR_TOUCH1_ID); // id1 = 0 or 1
|
||||||
int16_t x = this->read_touch_coordinate_(FT63X6_ADDR_TOUCH1_X);
|
int16_t x = this->read_touch_coordinate_(FT63X6_ADDR_TOUCH1_X);
|
||||||
int16_t y = this->read_touch_coordinate_(FT63X6_ADDR_TOUCH1_Y);
|
int16_t y = this->read_touch_coordinate_(FT63X6_ADDR_TOUCH1_Y);
|
||||||
this->set_raw_touch_position_(touch_id, x, y);
|
this->add_raw_touch_position_(touch_id, x, y);
|
||||||
|
|
||||||
if (touch_count >= 2) {
|
if (touch_count >= 2) {
|
||||||
touch_id = this->read_touch_id_(FT63X6_ADDR_TOUCH2_ID); // id2 = 0 or 1(~id1 & 0x01)
|
touch_id = this->read_touch_id_(FT63X6_ADDR_TOUCH2_ID); // id2 = 0 or 1(~id1 & 0x01)
|
||||||
x = this->read_touch_coordinate_(FT63X6_ADDR_TOUCH2_X);
|
x = this->read_touch_coordinate_(FT63X6_ADDR_TOUCH2_X);
|
||||||
y = this->read_touch_coordinate_(FT63X6_ADDR_TOUCH2_Y);
|
y = this->read_touch_coordinate_(FT63X6_ADDR_TOUCH2_Y);
|
||||||
this->set_raw_touch_position_(touch_id, x, y);
|
this->add_raw_touch_position_(touch_id, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ void GT911Touchscreen::update_touches() {
|
||||||
uint16_t id = data[i][0];
|
uint16_t id = data[i][0];
|
||||||
uint16_t x = encode_uint16(data[i][2], data[i][1]);
|
uint16_t x = encode_uint16(data[i][2], data[i][1]);
|
||||||
uint16_t y = encode_uint16(data[i][4], data[i][3]);
|
uint16_t y = encode_uint16(data[i][4], data[i][3]);
|
||||||
this->set_raw_touch_position_(id, x, y);
|
this->add_raw_touch_position_(id, x, y);
|
||||||
}
|
}
|
||||||
auto keys = data[num_of_touches][0];
|
auto keys = data[num_of_touches][0];
|
||||||
for (size_t i = 0; i != 4; i++) {
|
for (size_t i = 0; i != 4; i++) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ void LilygoT547Touchscreen::update_touches() {
|
||||||
id = (buffer[i * 5] >> 4) & 0x0F;
|
id = (buffer[i * 5] >> 4) & 0x0F;
|
||||||
y_raw = (uint16_t) ((buffer[i * 5 + 1] << 4) | ((buffer[i * 5 + 3] >> 4) & 0x0F));
|
y_raw = (uint16_t) ((buffer[i * 5 + 1] << 4) | ((buffer[i * 5 + 3] >> 4) & 0x0F));
|
||||||
x_raw = (uint16_t) ((buffer[i * 5 + 2] << 4) | (buffer[i * 5 + 3] & 0x0F));
|
x_raw = (uint16_t) ((buffer[i * 5 + 2] << 4) | (buffer[i * 5 + 3] & 0x0F));
|
||||||
this->set_raw_touch_position_(id, x_raw, y_raw);
|
this->add_raw_touch_position_(id, x_raw, y_raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
|
|
|
@ -51,7 +51,7 @@ void Touchscreen::loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touchscreen::set_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_raw, int16_t z_raw) {
|
void Touchscreen::add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_raw, int16_t z_raw) {
|
||||||
TouchPoint tp;
|
TouchPoint tp;
|
||||||
uint16_t x, y;
|
uint16_t x, y;
|
||||||
if (this->touches_.count(id) == 0) {
|
if (this->touches_.count(id) == 0) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ class Touchscreen : public PollingComponent {
|
||||||
|
|
||||||
void attach_interrupt_(InternalGPIOPin *irq_pin, esphome::gpio::InterruptType type);
|
void attach_interrupt_(InternalGPIOPin *irq_pin, esphome::gpio::InterruptType type);
|
||||||
|
|
||||||
void set_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_raw, int16_t z_raw = 0);
|
void add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_raw, int16_t z_raw = 0);
|
||||||
|
|
||||||
void send_touches_();
|
void send_touches_();
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ void TT21100Touchscreen::update_touches() {
|
||||||
i, touch->touch_type, touch->tip, touch->event_id, touch->touch_id, touch->x, touch->y,
|
i, touch->touch_type, touch->tip, touch->event_id, touch->touch_id, touch->x, touch->y,
|
||||||
touch->pressure, touch->major_axis_length, touch->orientation);
|
touch->pressure, touch->major_axis_length, touch->orientation);
|
||||||
|
|
||||||
this->set_raw_touch_position_(touch->tip, touch->x, touch->y, touch->pressure);
|
this->add_raw_touch_position_(touch->tip, touch->x, touch->y, touch->pressure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ void XPT2046Component::update_touches() {
|
||||||
|
|
||||||
ESP_LOGV(TAG, "Touchscreen Update [%d, %d], z = %d", x_raw, y_raw, z_raw);
|
ESP_LOGV(TAG, "Touchscreen Update [%d, %d], z = %d", x_raw, y_raw, z_raw);
|
||||||
|
|
||||||
this->set_raw_touch_position_(0, x_raw, y_raw, z_raw);
|
this->add_raw_touch_position_(0, x_raw, y_raw, z_raw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue