diff --git a/tasmota/support.ino b/tasmota/support.ino index b94161c33..0840bf5cf 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -2004,22 +2004,19 @@ bool I2cBegin(int sda, int scl, uint32_t frequency) { Wire.begin(sda, scl); #endif #ifdef ESP32 +#if ESP_IDF_VERSION_MAJOR > 3 // Core 2.x uses a different I2C library + static bool reinit = false; + if (reinit) { Wire.end(); } +#endif // ESP_IDF_VERSION_MAJOR > 3 result = Wire.begin(sda, scl, frequency); +#if ESP_IDF_VERSION_MAJOR > 3 // Core 2.x uses a different I2C library + reinit = result; +#endif // ESP_IDF_VERSION_MAJOR > 3 #endif // AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Bus1 %d"), result); return result; } -bool I2cEnd(void) { - bool result = true; -#ifdef ESP32 -#if ESP_IDF_VERSION_MAJOR > 3 - result = Wire.end(); -#endif -#endif - return result; -} - #ifdef ESP32 bool I2c2Begin(int sda, int scl, uint32_t frequency = 100000); bool I2c2Begin(int sda, int scl, uint32_t frequency) { diff --git a/tasmota/xsns_07_sht1x.ino b/tasmota/xsns_07_sht1x.ino index d9ff9639f..5b5419648 100644 --- a/tasmota/xsns_07_sht1x.ino +++ b/tasmota/xsns_07_sht1x.ino @@ -165,7 +165,6 @@ void ShtDetect(void) sht_type = 1; AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C D_SHT1X_FOUND)); } else { - I2cEnd(); I2cBegin(sht_sda_pin, sht_scl_pin); sht_type = 0; }