From ea0b1b407845072d22793ced13b1226a297bb104 Mon Sep 17 00:00:00 2001 From: arduino12 Date: Sun, 17 Sep 2023 19:05:37 +0300 Subject: [PATCH] Fix touch flickering caused by invalid buffer status! See page 26 in "GT911 Programming Guide" https://www.crystalfontz.com/controllers/GOODIX/GT911ProgrammingGuide/478/ :) --- TAMC_GT911.cpp | 6 +++++- TAMC_GT911.h | 3 +-- library.properties | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/TAMC_GT911.cpp b/TAMC_GT911.cpp index 2c62148..0e60e49 100644 --- a/TAMC_GT911.cpp +++ b/TAMC_GT911.cpp @@ -1,4 +1,4 @@ -#include "Arduino.h" +#include #include #include @@ -70,6 +70,10 @@ void TAMC_GT911::read(void) { uint8_t bufferStatus = pointInfo >> 7 & 1; uint8_t proximityValid = pointInfo >> 5 & 1; uint8_t haveKey = pointInfo >> 4 & 1; + + if (!bufferStatus) + return; + isLargeDetect = pointInfo >> 6 & 1; touches = pointInfo & 0xF; // Serial.print("bufferStatus: ");Serial.println(bufferStatus); diff --git a/TAMC_GT911.h b/TAMC_GT911.h index 02161df..6ea4fb0 100644 --- a/TAMC_GT911.h +++ b/TAMC_GT911.h @@ -2,7 +2,7 @@ #ifndef TAMC_GT911_H #define TAMC_GT911_H -#include "Arduino.h" +#include #include #define GT911_ADDR1 (uint8_t)0x5D @@ -13,7 +13,6 @@ #define ROTATION_RIGHT (uint8_t)2 #define ROTATION_NORMAL (uint8_t)3 - // Real-time command (Write only) #define GT911_COMMAND (uint16_t)0x8040 #define GT911_ESD_CHECK (uint16_t)0x8041 diff --git a/library.properties b/library.properties index 3dcd40e..a87aee8 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TAMC_GT911 -version=1.0.2 +version=1.0.3 author=TAMC maintainer=TAMC sentence=Arduino library for GT911