From: Carson McDonald Date: Sun, 18 Oct 2020 13:30:37 +0000 (-0400) Subject: If the number of retries is exceeded raise an error X-Git-Tag: 5.5.4^2 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/b668b5c9a24b38c980830b710c4a0d1c396268cc If the number of retries is exceeded raise an error --- diff --git a/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py b/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py index 0275e66..e01eb7b 100644 --- a/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py +++ b/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py @@ -285,6 +285,8 @@ class MCP2221: continue if resp[2] in (RESP_READ_COMPL, RESP_READ_PARTIAL): break + else: + raise RuntimeError("I2C read error: max retries reached.") # move data into buffer chunk = min(end - start, 60)