diff --git a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp index 7ea9aa0e6..0bc75395f 100644 --- a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp +++ b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp @@ -623,6 +623,22 @@ int8_t Renderer::color_type(void) { return 0; } +bool Renderer::utouch_Init(char **name) { + return false; +} + +bool Renderer::touched(void) { + return false; +} + +int16_t Renderer::getPoint_x(void) { + return 0; +} + +int16_t Renderer::getPoint_y(void) { + return 0; +} + void Renderer::Splash(void) { } diff --git a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h index 279ab514d..a63c4a93f 100644 --- a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h +++ b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h @@ -92,6 +92,10 @@ public: virtual void ep_update_mode(uint8_t mode); virtual void ep_update_area(uint16_t xp, uint16_t yp, uint16_t width, uint16_t height, uint8_t mode); virtual uint32_t get_sr_touch(uint32_t xp, uint32_t xm, uint32_t yp, uint32_t ym); + virtual bool utouch_Init(char **); + virtual bool touched(void); + virtual int16_t getPoint_x(); + virtual int16_t getPoint_y(); void setDrawMode(uint8_t mode); uint8_t drawmode; diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp index 6b2262f32..f46032dac 100755 --- a/lib/lib_display/UDisplay/uDisplay.cpp +++ b/lib/lib_display/UDisplay/uDisplay.cpp @@ -37,6 +37,9 @@ extern int Cache_WriteBack_Addr(uint32_t addr, uint32_t size); #define renderer_swap(a, b) { int16_t t = a; a = b; b = t; } +enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE}; +extern void AddLog(uint32_t loglevel, PGM_P formatP, ...); + const uint16_t udisp_colors[]={UDISP_BLACK,UDISP_WHITE,UDISP_RED,UDISP_GREEN,UDISP_BLUE,UDISP_CYAN,UDISP_MAGENTA,\ UDISP_YELLOW,UDISP_NAVY,UDISP_DARKGREEN,UDISP_DARKCYAN,UDISP_MAROON,UDISP_PURPLE,UDISP_OLIVE,\ UDISP_LIGHTGREY,UDISP_DARKGREY,UDISP_ORANGE,UDISP_GREENYELLOW,UDISP_PINK}; @@ -136,6 +139,18 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { lut_cmd[cnt] = 0xff; lut_array[cnt] = 0; } + +#ifdef USE_UNIVERSAL_TOUCH + ut_init_code[0] = UT_RT; + ut_init_code[1] = UT_END; + ut_touch_code[0] = UT_RT; + ut_touch_code[1] = UT_END; + ut_getx_code[0] = UT_RT; + ut_getx_code[1] = UT_END; + ut_gety_code[0] = UT_RT; + ut_gety_code[1] = UT_END; +#endif // USE_UNIVERSAL_TOUCH + lut_partial = 0; lut_full = 0; char linebuff[UDSP_LBSIZE]; @@ -542,6 +557,68 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { case 'b': bpmode = next_val(&lp1); break; +#ifdef USE_UNIVERSAL_TOUCH + case 'U': + if (!strncmp(lp1, "TI", 2)) { + // init + ut_wire = 0; + ut_reset = -1; + ut_irq = -1; + lp1 += 3; + str2c(&lp1, ut_name, sizeof(ut_name)); + if (*lp1 == 'I') { + // i2c mode + lp1++; + uint8_t ut_mode = *lp1 & 0xf; + lp1 += 2; + ut_i2caddr = next_hex(&lp1); + ut_reset = next_val(&lp1); + ut_irq = next_val(&lp1); + + if (ut_mode == 1) { + ut_wire = &Wire; + } else { +#ifdef ESP32 + ut_wire = &Wire1; +#else + ut_wire = &Wire; +#endif + } + } else if (*lp1 == 'S') { + // spi mode + lp1++; + uint8_t ut_mode = *lp1 & 0xf; + lp1 += 2; + ut_reset = -1; + ut_irq = -1; + ut_spi_cs = next_val(&lp1); + ut_reset = next_val(&lp1); + ut_irq = next_val(&lp1); + // assume displays SPI bus + pinMode(ut_spi_cs, OUTPUT); + digitalWrite(ut_spi_cs, HIGH); + + ut_spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0); + } else { + // simple resistive touch + lp1++; + } + ut_trans(&lp, ut_init_code, sizeof(ut_init_code)); + } else if (!strncmp(lp1, "TT", 2)) { + lp1 += 2; + // touch + ut_trans(&lp, ut_touch_code, sizeof(ut_touch_code)); + } else if (!strncmp(lp1, "TX", 2)) { + lp1 += 2; + // get x + ut_trans(&lp, ut_getx_code, sizeof(ut_getx_code)); + } else if (!strncmp(lp1, "TY", 2)) { + lp1 += 2; + // get y + ut_trans(&lp, ut_gety_code, sizeof(ut_gety_code)); + } + break; +#endif // USE_UNIVERSAL_TOUCH } } } @@ -1815,6 +1892,52 @@ for(y=h; y>0; y--) { } */ +#ifdef USE_UNIVERSAL_TOUCH + +uint8_t ut_irq_flg; + +void IRAM_ATTR ut_touch_irq(void) { + ut_irq_flg = 1; +} + +// universal touch driver +bool uDisplay::utouch_Init(char **name) { + *name = ut_name; + if (ut_reset >= 0) { + pinMode(ut_reset, OUTPUT); + digitalWrite(ut_reset, HIGH); + delay(10); + digitalWrite(ut_reset, LOW); + delay(5); + digitalWrite(ut_reset, HIGH); + delay(10); + } + if (ut_irq >= 0) { + attachInterrupt(ut_irq, ut_touch_irq, FALLING); + } + + return ut_execute(ut_init_code); +} + +bool uDisplay::touched(void) { + if (ut_irq >= 0) { + if (!ut_irq_flg) { + return false; + } + ut_irq_flg = 0; + } + return ut_execute(ut_touch_code); +} + +int16_t uDisplay::getPoint_x(void) { + return ut_execute(ut_getx_code); +} + +int16_t uDisplay::getPoint_y(void) { + return ut_execute(ut_gety_code); +} +#endif // USE_UNIVERSAL_TOUCH + void uDisplay::Splash(void) { @@ -2461,6 +2584,303 @@ char *uDisplay::devname(void) { return dname; } + + +#ifdef USE_UNIVERSAL_TOUCH + +uint16_t uDisplay::ut_par(char **lp, uint32_t mode) { + char *cp = *lp; + while (*cp != ' ') { + cp++; + } + cp++; + uint16_t result; + if (!mode) { + result = strtol(cp, &cp, 16); + } else { + result = strtol(cp, &cp, 10); + } + *lp = cp; + return result; +} + +void uDisplay::ut_trans(char **sp, uint8_t *ut_code, int32_t size) { + char *cp = *sp; + uint16_t wval; + while (*cp) { + if (*cp == ':' || *cp == '#') { + break; + } + if (!strncmp(cp, "RDWM", 4)) { + // read word many + *ut_code++ = UT_RDWM; + wval = ut_par(&cp, 0); + *ut_code++ = wval>>8; + *ut_code++ = wval; + wval = ut_par(&cp, 1); + if (wval > sizeof(ut_array)) { + wval = sizeof(ut_array); + } + *ut_code++ = wval; + size -= 4; + } else if (!strncmp(cp, "RDW", 3)) { + // read word one + *ut_code++ = UT_RDW; + wval = ut_par(&cp, 0); + *ut_code++ = wval>>8; + *ut_code++ = wval; + size -= 3; + } else if (!strncmp(cp, "RDM", 3)) { + // read many + *ut_code++ = UT_RDM; + *ut_code++ = ut_par(&cp, 0); + wval = ut_par(&cp, 1); + if (wval > sizeof(ut_array)) { + wval = sizeof(ut_array); + } + *ut_code++ = wval; + size -= 3; + } else if (!strncmp(cp, "RD", 2)) { + // read one + *ut_code++ = UT_RD; + *ut_code++ = ut_par(&cp, 0); + size -= 2; + } else if (!strncmp(cp, "CPR", 3)) { + // cmp and set + *ut_code++ = UT_CPR; + *ut_code++ = ut_par(&cp, 0); + size -= 2; + } else if (!strncmp(cp, "CP", 2)) { + // cmp and set + *ut_code++ = UT_CP; + *ut_code++ = ut_par(&cp, 0); + size -= 2; + } else if (!strncmp(cp, "RTF", 3)) { + // return when false + *ut_code++ = UT_RTF; + size -= 1; + } else if (!strncmp(cp, "RTT", 3)) { + // return when true + *ut_code++ = UT_RTT; + size -= 1; + } else if (!strncmp(cp, "MV", 2)) { + // move + *ut_code++ = UT_MV; + *ut_code++ = ut_par(&cp, 1); + *ut_code++ = ut_par(&cp, 1); + size -= 3; + } else if (!strncmp(cp, "RT", 2)) { + // return status + *ut_code++ = UT_RT; + size -= 1; + } else if (!strncmp(cp, "WRW", 3)) { + *ut_code++ = UT_WRW; + wval = ut_par(&cp, 0); + *ut_code++ = wval>>8; + *ut_code++ = wval; + wval = ut_par(&cp, 0); + *ut_code++ = wval; + size -= 4; + } else if (!strncmp(cp, "WR", 2)) { + *ut_code++ = UT_WR; + wval = ut_par(&cp, 0); + *ut_code++ = wval; + wval = ut_par(&cp, 0); + *ut_code++ = wval; + size -= 3; + } else if (!strncmp(cp, "AND", 3)) { + *ut_code++ = UT_AND; + wval = ut_par(&cp, 0); + *ut_code++ = wval>>8; + *ut_code++ = wval; + size -= 3; + } else if (!strncmp(cp, "GSRT", 4)) { + *ut_code++ = UT_GSRT; + wval = ut_par(&cp, 1); + *ut_code++ = wval>>8; + *ut_code++ = wval; + size -= 3; + } else if (!strncmp(cp, "DBG", 3)) { + *ut_code++ = UT_DBG; + wval = ut_par(&cp, 1); + *ut_code++ = wval; + size -= 2; + } + if (size <= 1) { + break; + } + + cp++; + } + *ut_code++ = UT_END; + *sp = cp - 1; +} + +uint8_t *uDisplay::ut_rd(uint8_t *iop, uint32_t len, uint32_t amode) { + if (ut_wire) { + // i2c mode + ut_wire->beginTransmission(ut_i2caddr); + ut_wire->write(*iop++); + if (amode == 2) { + ut_wire->write(*iop++); + } + ut_wire->endTransmission(false); + if (len > 1) { + len = *iop++; + } + ut_wire->requestFrom(ut_i2caddr, (size_t)len); + uint8_t index = 0; + while (ut_wire->available()) { + ut_array[index++] = ut_wire->read(); + } + } else { + // spi mode + uint16_t val = *iop++; + digitalWrite(ut_spi_cs, LOW); + if (spi_nr <= 2) { + uspi->beginTransaction(ut_spiSettings); + val = uspi->transfer16(val); + uspi->endTransaction(); + ut_array[0] = val << 8; + ut_array[1] = val; + } + digitalWrite(ut_spi_cs, HIGH); + } + return iop; +} + +uint8_t *uDisplay::ut_wr(uint8_t *iop, uint32_t amode) { + if (ut_wire) { + // i2c mode + ut_wire->beginTransmission(ut_i2caddr); + ut_wire->write(*iop++); + if (amode == 2) { + ut_wire->write(*iop++); + } + ut_wire->write(*iop++); + ut_wire->endTransmission(true); + } else { + // spi mode + } + return iop; +} + +int16_t uDisplay::ut_execute(uint8_t *ut_code) { +int16_t result = 0; +uint8_t iob, len; +uint16_t wval; + + while (*ut_code != UT_END) { + iob = *ut_code++; + switch (iob) { + case UT_RD: + // read 1 byte + ut_code = ut_rd(ut_code, 1, 1); + break; + case UT_RDM: + // read multiple bytes + ut_code = ut_rd(ut_code, 2, 1); + break; + case UT_RDW: + // read 1 byte + ut_code = ut_rd(ut_code, 1, 2); + break; + case UT_RDWM: + // read multiple bytes + ut_code = ut_rd(ut_code, 2, 2); + break; + case UT_WR: + ut_code = ut_wr(ut_code, 1); + break; + case UT_WRW: + ut_code = ut_wr(ut_code, 2); + break; + case UT_CP: + // compare + iob = *ut_code++; + result = (iob == ut_array[0]); + break; + case UT_CPR: + // compare + iob = *ut_code++; + result = (iob == result); + break; + case UT_RTF: + // return when false + if (result == 0) { + return false; + } + break; + case UT_RTT: + // return when true + if (result > 0) { + return false; + } + break; + case UT_MV: + // move + // source + result = *ut_code++; + iob = *ut_code++; + if (iob == 1) { + result = ut_array[result]; + } else if (iob == 2) { + iob = result; + result = ut_array[iob] << 8; + result |= ut_array[iob + 1]; + } else { + iob = result; + result = ut_array[iob + 1] << 8; + result |= ut_array[iob]; + } + result &= 0xfff; + break; + case UT_AND: + // and + wval = *ut_code++ << 8; + wval |= *ut_code++; + result &= wval; + break; + case UT_RT: + // result + return result; + break; + case UT_GSRT: +#ifdef USE_ESP32_S3 + { uint32_t val = get_sr_touch(SIMPLERS_XP, SIMPLERS_XM, SIMPLERS_YP, SIMPLERS_YM); + if (val == 0) { + return false; + } + uint16_t xp = val >> 16; + uint16_t yp = val; + + wval = *ut_code++ << 8; + wval |= *ut_code++; + if (xp > wval && yp > wval) { + ut_array[0] = val >> 24; + ut_array[1] = val >> 16; + ut_array[2] = val >> 8; + ut_array[3] = val; + return true; + } + return false; + } +#endif // USE_ESP32_S3 + break; + case UT_DBG: + // debug show result + //Serial.printf("UTDBG: %d\n", result); + wval = *ut_code++; + AddLog(LOG_LEVEL_INFO, PSTR("UTDBG %d: %02x : %02x,%02x,%02x,%02x"), wval, result, ut_array[0], ut_array[1], ut_array[2], ut_array[3]); + break; + case UT_END: + break; + } + } + return result; +} +#endif // USE_UNIVERSAL_TOUCH + uint32_t uDisplay::str2c(char **sp, char *vp, uint32_t len) { char *lp = *sp; if (len) len--; diff --git a/lib/lib_display/UDisplay/uDisplay.h b/lib/lib_display/UDisplay/uDisplay.h index 238802dca..21e2eb6f3 100755 --- a/lib/lib_display/UDisplay/uDisplay.h +++ b/lib/lib_display/UDisplay/uDisplay.h @@ -101,6 +101,15 @@ enum uColorType { uCOLOR_BW, uCOLOR_COLOR }; #define GPIO_SET(A) GPIO.out_w1ts = (1 << A) #endif +enum { + UT_RD,UT_RDM,UT_CP,UT_RTF,UT_MV,UT_RT,UT_RTT,UT_RDW,UT_RDWM,UT_WR,UT_WRW,UT_CPR,UT_AND,UT_DBG,UT_GSRT,UT_END +}; + +#define SIMPLERS_XP par_dbl[1] +#define SIMPLERS_XM par_cs +#define SIMPLERS_YP par_rs +#define SIMPLERS_YM par_dbl[0] + #define GPIO_CLR_SLOW(A) digitalWrite(A, LOW) #define GPIO_SET_SLOW(A) digitalWrite(A, HIGH) @@ -190,6 +199,13 @@ class uDisplay : public Renderer { void invertDisplay(boolean i); void SetPwrCB(pwr_cb cb) { pwr_cbp = cb; }; void SetDimCB(dim_cb cb) { dim_cbp = cb; }; +#ifdef USE_UNIVERSAL_TOUCH +// universal touch driver + bool utouch_Init(char **name); + bool touched(void); + int16_t getPoint_x(); + int16_t getPoint_y(); +#endif // USE_UNIVERSAL_TOUCH private: void beginTransaction(SPISettings s); @@ -411,6 +427,29 @@ class uDisplay : public Renderer { void pushPixelsDMA(uint16_t* image, uint32_t len); void pushPixels3DMA(uint8_t* image, uint32_t len); #endif // ESP32 + +#ifdef USE_UNIVERSAL_TOUCH +// universal touch driver + void ut_trans(char **sp, uint8_t *ut_code, int32_t size); + int16_t ut_execute(uint8_t *ut_code); + uint16_t ut_par(char **cp, uint32_t mode); + uint8_t *ut_rd(uint8_t *io, uint32_t len, uint32_t amode); + uint8_t *ut_wr(uint8_t *io, uint32_t amode); + uint32_t ut_result; + uint8_t ut_array[16]; + uint8_t ut_i2caddr; + uint8_t ut_spi_cs; + int8_t ut_reset; + int8_t ut_irq; + TwoWire *ut_wire; + SPISettings ut_spiSettings; + char ut_name[8]; + uint8_t ut_init_code[32]; + uint8_t ut_touch_code[32]; + uint8_t ut_getx_code[16]; + uint8_t ut_gety_code[16]; + +#endif // USE_UNIVERSAL_TOUCH }; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino index 9b71d05c5..76903985e 100755 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino @@ -5875,7 +5875,7 @@ extern char *SML_GetSVal(uint32_t index); goto exit; } #endif // USE_TTGO_WATCH -#if defined(USE_FT5206) || defined(USE_XPT2046) || defined(USE_LILYGO47) || defined(USE_GT911) +#if defined(USE_FT5206) || defined(USE_XPT2046) || defined(USE_LILYGO47) || defined(USE_UNIVERSAL_TOUCH) || defined(USE_GT911) if (!strncmp_XP(lp, XPSTR("wtch("), 5)) { lp = GetNumericArgument(lp + 5, OPER_EQU, &fvar, gv); fvar = Touch_Status(fvar); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_55_touch.ino b/tasmota/tasmota_xdrv_driver/xdrv_55_touch.ino index d7738e80a..1801fb3d6 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_55_touch.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_55_touch.ino @@ -36,11 +36,7 @@ \*******************************************************************************************/ -#if defined(USE_LVGL_TOUCHSCREEN) || defined(USE_FT5206) || defined(USE_XPT2046) || defined(USE_GT911) || defined(USE_LILYGO47) || defined(USE_TOUCH_BUTTONS) || defined(SIMPLE_RES_TOUCH) - -#ifdef USE_DISPLAY_LVGL_ONLY -#undef USE_TOUCH_BUTTONS -#endif +#if defined(USE_LVGL_TOUCHSCREEN) || defined(USE_FT5206) || defined(USE_XPT2046) || defined(USE_GT911) || defined(USE_LILYGO47) || defined(USE_UNIVERSAL_TOUCH) || defined(USE_TOUCH_BUTTONS) || defined(SIMPLE_RES_TOUCH) #include @@ -76,6 +72,7 @@ bool FT5206_found = false; bool GT911_found = false; bool XPT2046_found = false; bool SRES_found = false; +bool utouch_found = false; #ifndef MAX_TOUCH_BUTTONS #define MAX_TOUCH_BUTTONS 16 @@ -98,7 +95,7 @@ void Touch_SetStatus(uint8_t touches, uint16_t raw_x, uint16_t raw_y, uint8_t ge // return true if succesful, false if not configured bool Touch_GetStatus(uint8_t* touches, uint16_t* x, uint16_t* y, uint8_t* gesture, uint16_t* raw_x, uint16_t* raw_y) { - if (TSGlobal.external_ts || CST816S_found || FT5206_found || XPT2046_found) { + if (TSGlobal.external_ts || CST816S_found || FT5206_found || XPT2046_found || utouch_found) { if (touches) { *touches = TSGlobal.touches; } if (x) { *x = TSGlobal.touch_xp; } if (y) { *y = TSGlobal.touch_yp; } @@ -111,7 +108,7 @@ bool Touch_GetStatus(uint8_t* touches, uint16_t* x, uint16_t* y, uint8_t* gestur } uint32_t Touch_Status(int32_t sel) { - if (TSGlobal.external_ts || CST816S_found || FT5206_found || GT911_found || XPT2046_found || SRES_found) { + if (TSGlobal.external_ts || CST816S_found || FT5206_found || GT911_found || XPT2046_found || utouch_found || SRES_found) { switch (sel) { case 0: return TSGlobal.touched; @@ -242,6 +239,40 @@ bool CST816S_Touch_Init(uint8_t bus, int8_t irq_pin, int8_t rst_pin, int interru } #endif // USE_CST816S + +#ifdef USE_UNIVERSAL_TOUCH + +void utouch_Touch_Init() { + if (renderer) { + char *name; + utouch_found = renderer->utouch_Init(&name); + if (utouch_found) { + AddLog(LOG_LEVEL_INFO, PSTR("UT: %s"), name); + } + } +} + +bool utouch_touched() { + if (renderer) { + return renderer->touched(); + } +} +int16_t utouch_x() { + if (renderer) { + return renderer->getPoint_x(); + } else { + return 0; + } +} +int16_t utouch_y() { + if (renderer) { + return renderer->getPoint_y(); + } else { + return 0; + } +} +#endif // USE_UNIVERSAL_TOUCH + #ifdef USE_FT5206 #include // touch panel controller @@ -370,6 +401,16 @@ void Touch_Check(void(*rotconvert)(int16_t *x, int16_t *y)) { } #endif // USE_CST816S +#ifdef USE_UNIVERSAL_TOUCH + if (utouch_found) { + TSGlobal.touched = utouch_touched(); + if (TSGlobal.touched) { + TSGlobal.raw_touch_xp = utouch_x(); + TSGlobal.raw_touch_yp = utouch_y(); + } + } +#endif // USE_UNIVERSAL_TOUCH + #ifdef USE_FT5206 if (FT5206_found) { TSGlobal.touched = FT5206_touched(); @@ -459,6 +500,9 @@ void Touch_MQTT(uint8_t index, const char *cp, uint32_t val) { #ifdef USE_FT5206 if (FT5206_found) ResponseTime_P(PSTR(",\"FT5206\":{\"%s%d\":\"%d\"}}"), cp, index + 1, val); #endif +#ifdef USE_UNIVERSAL_TOUCH + if (utouch_found) ResponseTime_P(PSTR(",\"UTOUCH\":{\"%s%d\":\"%d\"}}"), cp, index + 1, val); +#endif #ifdef USE_XPT2046 if (XPT2046_found) ResponseTime_P(PSTR(",\"XPT2046\":{\"%s%d\":\"%d\"}}"), cp, index + 1, val); #endif // USE_XPT2046 @@ -585,7 +629,7 @@ bool Xdrv55(uint32_t function) { case FUNC_INIT: break; case FUNC_EVERY_100_MSECOND: - if (CST816S_found || FT5206_found || XPT2046_found || GT911_found || SRES_found) { + if (CST816S_found || FT5206_found || XPT2046_found || GT911_found || utouch_found || SRES_found) { Touch_Check(TS_RotConvert); } break; diff --git a/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino b/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino index b9213ed17..02d942eae 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino @@ -374,6 +374,7 @@ int8_t cs; #endif // ESP8266 // start digitizer + #ifdef ESP32 if (i2caddr == GT911_address) { #ifdef USE_GT911 @@ -468,13 +469,18 @@ int8_t cs; Settings->display_width = renderer->width(); Settings->display_height = renderer->height(); +#ifdef USE_UNIVERSAL_TOUCH + utouch_Touch_Init(); +#endif + bool iniinv = Settings->display_options.invert; + /* cp = strstr(ddesc, ":n,"); if (cp) { cp+=3; iniinv = strtol(cp, &cp, 10); Settings->display_options.invert = iniinv; - } + }*/ renderer->invertDisplay(iniinv); ApplyDisplayDimmer();