fix i2c touch init (#18594)

This commit is contained in:
gemu 2023-05-07 14:48:49 +02:00 committed by GitHub
parent 0287291cd9
commit a46b926530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,12 +175,16 @@ int8_t cs;
replacepin(&cp, Pin(GPIO_OLED_RESET)); replacepin(&cp, Pin(GPIO_OLED_RESET));
if (wire_n == 1) { if (wire_n == 1) {
if (!TasmotaGlobal.i2c_enabled) {
I2cBegin(sda, scl); I2cBegin(sda, scl);
} }
}
#ifdef ESP32 #ifdef ESP32
if (wire_n == 2) { if (wire_n == 2) {
if (!TasmotaGlobal.i2c_enabled_2) {
I2c2Begin(sda, scl); I2c2Begin(sda, scl);
} }
}
if (I2cSetDevice(i2caddr, wire_n - 1)) { if (I2cSetDevice(i2caddr, wire_n - 1)) {
I2cSetActiveFound(i2caddr, "DSP-I2C", wire_n - 1); I2cSetActiveFound(i2caddr, "DSP-I2C", wire_n - 1);
} }
@ -333,12 +337,16 @@ int8_t cs;
} }
if (wire_n == 0) { if (wire_n == 0) {
if (!TasmotaGlobal.i2c_enabled) {
I2cBegin(sda, scl); I2cBegin(sda, scl);
} }
}
#ifdef ESP32 #ifdef ESP32
if (wire_n == 1) { if (wire_n == 1) {
if (!TasmotaGlobal.i2c_enabled_2) {
I2c2Begin(sda, scl, 400000); I2c2Begin(sda, scl, 400000);
} }
}
if (I2cSetDevice(i2caddr, wire_n)) { if (I2cSetDevice(i2caddr, wire_n)) {
if (i2caddr == GT911_address) { if (i2caddr == GT911_address) {
I2cSetActiveFound(i2caddr, "GT911", wire_n); I2cSetActiveFound(i2caddr, "GT911", wire_n);