Skip to content

Retry logic for initial enabling of device from light_shutdown #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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