Skip to content

Commit

Permalink
Merge pull request #15 from BrianPugh/master
Browse files Browse the repository at this point in the history
Retry logic for initial enabling of device from light_shutdown.
  • Loading branch information
jposada202020 authored Apr 23, 2021
2 parents d6116bf + 8f2f24e commit b6a287e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion adafruit_veml7700.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,14 @@ class VEML7700:

def __init__(self, i2c_bus, address=0x10):
self.i2c_device = i2cdevice.I2CDevice(i2c_bus, address)
self.light_shutdown = False # Enable the ambient light sensor
for _ in range(3):
try:
self.light_shutdown = False # Enable the ambient light sensor
break
except OSError:
pass
else:
raise RuntimeError("Unable to enable VEML7700 device")

def integration_time_value(self):
"""Integration time value in integer form. Used for calculating ``resolution``."""
Expand Down

0 comments on commit b6a287e

Please sign in to comment.