This commit is contained in:
Thomas Göttgens
2024-06-17 15:09:38 +02:00
parent 00162b4ccf
commit b6066a78c1
3 changed files with 46 additions and 45 deletions

View File

@@ -148,7 +148,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
{
concurrency::LockGuard guard((concurrency::Lock *)&lock);
LOG_DEBUG("Scanning for i2c devices on port %d\n", port);
LOG_DEBUG("Scanning for I2C devices on port %d\n", port);
uint8_t err;
@@ -172,10 +172,11 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
#endif
for (addr.address = 1; addr.address < 127; addr.address++) {
if (asize != 0)
if (in_array(address, asize, addr.address))
if (asize != 0) {
if (!in_array(address, asize, addr.address))
continue;
LOG_DEBUG("Scanning address 0x%x\n", addr.address);
}
i2cBus->beginTransmission(addr.address);
#ifdef ARCH_PORTDUINO
if (i2cBus->read() != -1)
@@ -369,7 +370,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
LOG_INFO("Device found at address 0x%x was not able to be enumerated\n", addr.address);
}
} else if (err == 4) {
LOG_ERROR("Unknown error at address 0x%x\n", addr);
LOG_ERROR("Unknown error at address 0x%x\n", addr.address);
}
// Check if a type was found for the enumerated device - save, if so