Skip to content

Commit fa0c95c

Browse files
committed
Nexted the try/except blocks
1 parent c0e9f43 commit fa0c95c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

adafruit_pybadger.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,12 @@ def __init__(self, i2c=None):
8787
if i2c is None:
8888
i2c = board.I2C()
8989
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
90-
except RuntimeError:
91-
self._accelerometer = None
92-
93-
if i2c is not None:
9490
try:
9591
self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19, int1=int1)
9692
except ValueError:
9793
self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)
94+
except RuntimeError:
95+
self._accelerometer = None
9896

9997
# Buttons
10098
self._buttons = GamePadShift(digitalio.DigitalInOut(board.BUTTON_CLOCK),

0 commit comments

Comments
 (0)