From 7cad4f95b6339bec9f64977eacdc6b128c030cd1 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 14 May 2023 14:42:11 +0200 Subject: [PATCH] Enable I2c on webcam --- tasmota/include/tasmota_configurations_ESP32.h | 2 +- tasmota/tasmota_support/support_tasmota.ino | 8 ++++++++ tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tasmota/include/tasmota_configurations_ESP32.h b/tasmota/include/tasmota_configurations_ESP32.h index 74108b8b1..04a563c5c 100644 --- a/tasmota/include/tasmota_configurations_ESP32.h +++ b/tasmota/include/tasmota_configurations_ESP32.h @@ -205,7 +205,7 @@ #define USE_SPI #define USE_SDCARD -#undef USE_I2C +#define USE_I2C #undef USE_HOME_ASSISTANT #define USE_TASMOTA_DISCOVERY // Enable Tasmota Discovery support (+2k code) #undef USE_DOMOTICZ diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index c3cec04fd..2abe41635 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -2221,11 +2221,19 @@ void GpioInit(void) TasmotaGlobal.i2c_enabled = (PinUsed(GPIO_I2C_SCL) && PinUsed(GPIO_I2C_SDA)); if (TasmotaGlobal.i2c_enabled) { TasmotaGlobal.i2c_enabled = I2cBegin(Pin(GPIO_I2C_SDA), Pin(GPIO_I2C_SCL)); +#ifdef ESP32 + if (TasmotaGlobal.i2c_enabled) { + AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Pins bus1 SCL %d, SDA %d"), Pin(GPIO_I2C_SCL), Pin(GPIO_I2C_SDA)); + } +#endif } #ifdef ESP32 TasmotaGlobal.i2c_enabled_2 = (PinUsed(GPIO_I2C_SCL, 1) && PinUsed(GPIO_I2C_SDA, 1)); if (TasmotaGlobal.i2c_enabled_2) { TasmotaGlobal.i2c_enabled_2 = I2c2Begin(Pin(GPIO_I2C_SDA, 1), Pin(GPIO_I2C_SCL, 1)); + if (TasmotaGlobal.i2c_enabled_2) { + AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Pins bus2 SCL %d, SDA %d"), Pin(GPIO_I2C_SCL, 1), Pin(GPIO_I2C_SDA, 1)); + } } #endif #endif // USE_I2C diff --git a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino index 4697ab389..d9708abf0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino @@ -347,7 +347,7 @@ uint32_t WcSetup(int32_t fsiz) { if(TasmotaGlobal.i2c_enabled_2){ // configure SIOD and SIOC as SDA,2 and SCL,2 config.sccb_i2c_port = 1; // reuse initialized bus 2, can be shared now if(config.pin_sccb_sda < 0){ // GPIO_WEBCAM_SIOD must not be set to really make it happen - AddLog(LOG_LEVEL_INFO, PSTR("CAM: use I2C bus 2")); + AddLog(LOG_LEVEL_INFO, PSTR("CAM: Use I2C bus2")); } } config.pin_pwdn = Pin(GPIO_WEBCAM_PWDN); // PWDN_GPIO_NUM;