Skip to content

Commit b971ad8

Browse files
committed
components/M5Unified/mpy_lvgl.txt: Modify touch value reading logic.
Signed-off-by: lbuque <[email protected]>
1 parent 22a5da8 commit b971ad8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

m5stack/components/M5Unified/mpy_lvgl.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,15 @@ bool gfx_lvgl_touch_read(lv_disp_t *indev_drv, lv_indev_data_t *data)
190190
{
191191
M5.update();
192192

193-
if (!M5.Touch.getCount()) {
194-
data->point = (lv_point_t) { 0, 0 };
193+
if (M5.Touch.getCount()) {
194+
auto tp = M5.Touch.getDetail(0);
195+
data->point.x = tp.x;
196+
data->point.y = tp.y;
197+
data->state = LV_INDEV_STATE_PRESSED;
198+
} else {
195199
data->state = LV_INDEV_STATE_RELEASED;
196-
return false;
197200
}
198201

199-
auto tp = M5.Touch.getDetail(0);
200-
data->point = (lv_point_t) { tp.x, tp.y };
201-
data->state = LV_INDEV_STATE_PRESSED;
202202
return true;
203203
}
204204

0 commit comments

Comments
 (0)