The MCP2221 reports a RuntimeError when the i2c_scan function encounters a failure. This differs from CircuitPython, where it throws an OSError. Further, most sensor drivers with a "double-retry" (see this driver) are written to catch an OSError, rather than a RuntimeError.
This PR raises an OSError for the MCP2221 platform where it's expected, to fix I2C devices not initializing or being scanned correctly.
I've tested it with the MCP2221 and the MAX17048 as has @tyeth
The MCP2221 reports a
RuntimeError
when thei2c_scan
function encounters a failure. This differs from CircuitPython, where it throws anOSError
. Further, most sensor drivers with a "double-retry" (see this driver) are written to catch anOSError
, rather than aRuntimeError
.This PR raises an
OSError
for the MCP2221 platform where it's expected, to fix I2C devices not initializing or being scanned correctly.I've tested it with the MCP2221 and the MAX17048 as has @tyeth
Related: https://github.com/adafruit/Adafruit_Wippersnapper_Python/issues/173 https://github.com/adafruit/Adafruit_Wippersnapper_Python/pull/172#issue-2360866531