Skip to content

Commit 33ad835

Browse files
authored
Merge pull request #23 from jposada202020/correcting_assertions
correcting_assertions
2 parents 529b66a + 198ffe0 commit 33ad835

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adafruit_fxas21002c.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ class FXAS21002C:
110110
_BUFFER = bytearray(7)
111111

112112
def __init__(self, i2c, address=_FXAS21002C_ADDRESS, gyro_range=GYRO_RANGE_250DPS):
113-
assert gyro_range in (
113+
if gyro_range not in (
114114
GYRO_RANGE_250DPS,
115115
GYRO_RANGE_500DPS,
116116
GYRO_RANGE_1000DPS,
117117
GYRO_RANGE_2000DPS,
118-
)
118+
):
119+
raise Exception("gyro_range option selected is not a valid option")
119120
self._gyro_range = gyro_range
120121
self._device = i2c_dev.I2CDevice(i2c, address)
121122
# Check for chip ID value.

0 commit comments

Comments
 (0)