Reset sleep offset on local touch

This commit is contained in:
fvanroie 2022-04-09 23:26:58 +02:00
parent f0443301cc
commit 83011d3330
7 changed files with 15 additions and 8 deletions

View File

@ -60,6 +60,7 @@ class AnalogTouch : public BaseTouch {
data->point.x = map(tp.x, TS_LEFT, TS_RT, 0, max_x);
data->point.y = map(tp.y, TS_BOT, TS_TOP, max_y, 0);
data->state = LV_INDEV_STATE_PR;
hasp_set_sleep_offset(0); // Reset the offset
}
return false;

View File

@ -65,6 +65,7 @@ class TouchFt6336u : public BaseTouch {
data->point.x = ft6336u_touch->read_touch1_x();
data->point.y = ft6336u_touch->read_touch1_y();
data->state = LV_INDEV_STATE_PR;
hasp_set_sleep_offset(0); // Reset the offset
} else {
data->state = LV_INDEV_STATE_REL;
@ -95,13 +96,13 @@ class TouchFt6336u : public BaseTouch {
// handle these events. So instead, we set the INT wire to polled mode,
// so it simply goes low as long as there is at least one valid touch.
// ft6336u_touch->writeByte(0xA4, 0x00);
/* Wire1.beginTransmission(I2C_TOUCH_ADDRESS);
Wire1.write(0xA4); // address
Wire1.write(0x00); // data
Wire1.endTransmission();
/* Wire1.beginTransmission(I2C_TOUCH_ADDRESS);
Wire1.write(0xA4); // address
Wire1.write(0x00); // data
Wire1.endTransmission();
LOG_VERBOSE(TAG_DRVR, F("%s %d"), __FILE__, __LINE__);
touch_scan(Wire1);*/
LOG_VERBOSE(TAG_DRVR, F("%s %d"), __FILE__, __LINE__);
touch_scan(Wire1);*/
if(ft6336u_touch->read_chip_id() != 0) {
LOG_INFO(TAG_DRVR, F("FT6336U touch driver started chipid: %d"), ft6336u_touch->read_chip_id());

View File

@ -61,6 +61,7 @@ class TouchGsl1680 : public BaseTouch {
data->point.y = TFT_HEIGHT;
data->state = LV_INDEV_STATE_PR;
hasp_set_sleep_offset(0); // Reset the offset
} else {
data->state = LV_INDEV_STATE_REL;

View File

@ -78,6 +78,7 @@ class TouchGt911 : public BaseTouch {
data->point.x = points[0].x;
data->point.y = points[0].y;
data->state = LV_INDEV_STATE_PR;
hasp_set_sleep_offset(0); // Reset the offset
} else {
data->state = LV_INDEV_STATE_REL;

View File

@ -46,8 +46,9 @@ class TouchLovyanGfx : public BaseTouch {
data->point.x = touchX;
data->point.y = touchY;
data->state = LV_INDEV_STATE_PR;
hasp_set_sleep_offset(0); // Reset the offset
LOG_VERBOSE(TAG_DRVR, F("Touch: %d %d"), touchX, touchY);
} else {
data->state = LV_INDEV_STATE_REL;
}

View File

@ -38,6 +38,7 @@ bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
if(point.z && point.x < 4096 && point.y < 4096) { // valid reading
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
data->state = LV_INDEV_STATE_PR;
hasp_set_sleep_offset(0); // Reset the offset
#if HX8357D_DRIVER == 1
data->point.x = map(point.x, TS_MINX, TS_MAXX, TFT_WIDTH, 0);

View File

@ -38,7 +38,8 @@ class TouchTftEspi : public BaseTouch {
if(haspTft.tft.getTouch((uint16_t*)&data->point.x, (uint16_t*)&data->point.y, 300)) {
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
data->state = LV_INDEV_STATE_PR;
} else {
hasp_set_sleep_offset(0); // Reset the offset
} else {
data->state = LV_INDEV_STATE_REL;
}