From 195411155203035b3563d5f2fc8d9f906fdd0336 Mon Sep 17 00:00:00 2001 From: Stan Padgett Date: Tue, 7 Nov 2023 22:09:08 -0500 Subject: [PATCH] move gain set into try - tested with simple example --- adafruit_veml7700.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adafruit_veml7700.py b/adafruit_veml7700.py index 2b637f4..eb27909 100644 --- a/adafruit_veml7700.py +++ b/adafruit_veml7700.py @@ -193,10 +193,11 @@ class VEML7700: def __init__(self, i2c_bus: I2C, address: int = 0x10) -> None: self.i2c_device = i2cdevice.I2CDevice(i2c_bus, address) - # Set lowest gain to keep from overflow on init if bright light - self.light_gain=self.ALS_GAIN_1_8 for _ in range(3): try: + # Set lowest gain to keep from overflow on init if bright light + self.light_gain=self.ALS_GAIN_1_8 + # self.light_shutdown = False # Enable the ambient light sensor break except OSError: