Skip to content

Commit

Permalink
Move i2c transaction back into try/catch for detect
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Sep 4, 2019
1 parent 4c0f1f8 commit 970052e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions library/bme280/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ def setup(self, mode='normal', temperature_oversampling=16, pressure_oversamplin
if mode == "forced":
mode = "sleep"

chip = self._bme280.get('CHIP_ID')

try:
chip = self._bme280.get('CHIP_ID')
if chip.id != CHIP_ID:
raise RuntimeError("Unable to find bme280 on 0x{:02x}, CHIP_ID returned {:02x}".format(self._i2c_addr, chip.id))
except IOError:
Expand Down

0 comments on commit 970052e

Please sign in to comment.