From 649053007a9a6f7273e6cf1de7d7afc151978da3 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Thu, 6 Aug 2020 08:53:09 +0200 Subject: [PATCH] fix ft5206 watch touch controller --- lib/FT5206_Library/src/FT5206.cpp | 6 ++++-- tasmota/xdsp_12_ST7789.ino | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/FT5206_Library/src/FT5206.cpp b/lib/FT5206_Library/src/FT5206.cpp index 75860283e..29d4c6778 100755 --- a/lib/FT5206_Library/src/FT5206.cpp +++ b/lib/FT5206_Library/src/FT5206.cpp @@ -35,10 +35,12 @@ int FT5206_Class::begin(TwoWire &port, uint8_t addr) _address = addr; uint8_t val; _readByte(FT5206_VENDID_REG, 1, &val); + //Serial.printf("vend id %d\n",val ); if (val != FT5206_VENDID) { - return false; + // return false; } _readByte(FT5206_CHIPID_REG, 1, &val); + //Serial.printf("chip id %d\n",val ); if ((val != FT6206_CHIPID) && (val != FT6236_CHIPID) && (val != FT6236U_CHIPID) && (val != FT5206U_CHIPID)) { return false; } @@ -103,4 +105,4 @@ void FT5206_Class::_readRegister() _y[i] |= _data[TOUCH1_YL + i * 6]; _id[i] = _data[TOUCH1_YH + i * 6] >> 4; } -} \ No newline at end of file +} diff --git a/tasmota/xdsp_12_ST7789.ino b/tasmota/xdsp_12_ST7789.ino index a6d539da9..69440debf 100644 --- a/tasmota/xdsp_12_ST7789.ino +++ b/tasmota/xdsp_12_ST7789.ino @@ -53,7 +53,6 @@ Arduino_ST7789 *st7789; #ifdef USE_TOUCH_BUTTONS extern VButton *buttons[]; #endif -TwoWire I2C2 = TwoWire(1); FT5206_Class *touchp; uint8_t FT5206_found; TP_Point st7789_pLoc; @@ -142,11 +141,11 @@ void ST7789_InitDriver() // start digitizer with fixed adress and pins for esp32 #define SDA_2 23 #define SCL_2 32 - I2C2.begin(SDA_2, SCL_2, 400000); + Wire1.begin(SDA_2, SCL_2, 400000); touchp = new FT5206_Class(); - if (touchp->begin(I2C2, FT5206_address)) { + if (touchp->begin(Wire1, FT5206_address)) { FT5206_found=1; - I2cSetDevice(FT5206_address); + //I2cSetDevice(FT5206_address); I2cSetActiveFound(FT5206_address, "FT5206"); } else { FT5206_found=0;