mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 14:57:16 +00:00
Fix press detection
This commit is contained in:
parent
0aa52d3100
commit
3409b73d2b
@ -727,13 +727,19 @@ extern "C" {
|
||||
}
|
||||
|
||||
bool lvbe_touch_screen_read(lv_indev_drv_t * drv, lv_indev_data_t*data){
|
||||
static int16_t prev_x = 0;
|
||||
static int16_t prev_y = 0;
|
||||
int16_t touchpad_x, touchpad_y;
|
||||
int32_t touched;
|
||||
int32_t touchpad_press;
|
||||
|
||||
if (udisp_ReadTouch(&touchpad_x, &touchpad_y, &touched)) {
|
||||
data->point.x = touchpad_x;
|
||||
data->point.y = touchpad_y;
|
||||
data->state = touched ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
|
||||
if (udisp_ReadTouch(&touchpad_x, &touchpad_y, &touchpad_press)) {
|
||||
if (touchpad_press) {
|
||||
prev_x = touchpad_x;
|
||||
prev_y = touchpad_y;
|
||||
}
|
||||
data->point.x = prev_x;
|
||||
data->point.y = prev_y;
|
||||
data->state = touchpad_press ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
|
||||
}
|
||||
return false; // no more event in buffer
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ bool udisp_ReadTouch(int16_t * _x, int16_t * _y, int32_t * _touched) {
|
||||
// read from xdrv_55_touch.ino
|
||||
if (_x) { *_x = touch_xp; }
|
||||
if (_y) { *_y = touch_yp; }
|
||||
if (touched) { *_touched = touched; }
|
||||
if (_touched) { *_touched = touched ? 1 : 0; }
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user