diff --git a/framework/model/input/driver/touchscreen/touch_gt911.c b/framework/model/input/driver/touchscreen/touch_gt911.c index f2ab20be2b79ef4a90dd7492d28da984e9f6d10e..f7b8d94326f6bd75d099225387eb4b83eec53c25 100644 --- a/framework/model/input/driver/touchscreen/touch_gt911.c +++ b/framework/model/input/driver/touchscreen/touch_gt911.c @@ -15,6 +15,8 @@ #include "touch_gt911.h" #define MAX_POINT 5 +#define COMPENSATION_VALUE_Y 32 +#define UNCONTROLLABLE_VALUE_Y 10 static int32_t ChipInit(ChipDevice *device) { @@ -112,6 +114,9 @@ static void ParsePointData(ChipDevice *device, FrameData *frame, uint8_t *buf, u ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET)); frame->fingers[i].y = resY - ((buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | ((buf[GT_POINT_SIZE * i + GT_Y_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET)); + if (frame->fingers[i].y > UNCONTROLLABLE_VALUE_Y) { + frame->fingers[i].y += COMPENSATION_VALUE_Y; + } #elif defined(LOSCFG_PLATFORM_STM32MP157) frame->fingers[i].x = (buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET);