Skip to content

Commit

Permalink
Merge pull request #17 from caternuson/i2c_update
Browse files Browse the repository at this point in the history
Update I2C transceive
  • Loading branch information
caternuson committed May 22, 2020
2 parents 5fb3346 + 6572e2b commit d6396ea
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions adafruit_mlx90393.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,13 @@ def _transceive(self, payload, rxlen=0):
with self.i2c_device as i2c:
i2c.write(payload, stop=False)

while True:
# While busy, the sensor doesn't respond to reads.
try:
with self.i2c_device as i2c:
while True:
try:
i2c.readinto(data)
# Make sure we have something in the response
if data[0]:
break
except OSError:
pass
except OSError:
pass

# Track status byte
self._status_last = data[0]
Expand Down

0 comments on commit d6396ea

Please sign in to comment.