diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index d2a8cd2c0..a9f189990 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -2324,6 +2324,14 @@ void I2cScan(uint32_t bus) { // I2C_SCL_HELD_LOW_AFTER_READ 2 = I2C bus error. SCL held low beyond client clock stretch time // I2C_SDA_HELD_LOW 3 = I2C bus error. SDA line held low by client/another_master after n bits // I2C_SDA_HELD_LOW_AFTER_INIT 4 = line busy. SDA again held low by another device. 2nd master? + // 5 = bus busy. Timeout + // https://www.arduino.cc/reference/en/language/functions/communication/wire/endtransmission/ + // 0: success + // 1: data too long to fit in transmit buffer + // 2: received NACK on transmit of address + // 3: received NACK on transmit of data + // 4: other error + // 5: timeout uint8_t error = 0; uint8_t address = 0; @@ -2415,7 +2423,12 @@ bool I2cSetDevice(uint32_t addr, uint32_t bus) { return false; // If already active report as not present; } myWire.beginTransmission((uint8_t)addr); - return (0 == myWire.endTransmission()); +// return (0 == myWire.endTransmission()); + uint32_t err = myWire.endTransmission(); + if (err && (err != 2)) { + AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Error %d at 0x%02x"), err, addr); + } + return (0 == err); } #endif // USE_I2C