mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-28 04:07:47 +00:00
[ESP32-s2] Fix crash when scanning I2C bus
See: https://github.com/espressif/arduino-esp32/issues/5636
This commit is contained in:
@@ -173,7 +173,6 @@ void initI2C() {
|
||||
}
|
||||
addLog(LOG_LEVEL_INFO, F("INIT : I2C"));
|
||||
I2CSelectClockSpeed(false); // Set normal clock speed
|
||||
Wire.begin(Settings.Pin_i2c_sda, Settings.Pin_i2c_scl);
|
||||
|
||||
if (Settings.WireClockStretchLimit)
|
||||
{
|
||||
@@ -226,8 +225,13 @@ void I2CSelectClockSpeed(bool setLowSpeed) {
|
||||
// No need to change the clock speed.
|
||||
return;
|
||||
}
|
||||
lastI2CClockSpeed = newI2CClockSpeed;
|
||||
lastI2CClockSpeed = newI2CClockSpeed;
|
||||
#ifdef ESP32
|
||||
Wire.begin(Settings.Pin_i2c_sda, Settings.Pin_i2c_scl, newI2CClockSpeed);
|
||||
#else
|
||||
Wire.begin(Settings.Pin_i2c_sda, Settings.Pin_i2c_scl);
|
||||
Wire.setClock(newI2CClockSpeed);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FEATURE_I2CMULTIPLEXER
|
||||
|
||||
Reference in New Issue
Block a user