From d733c33cfde6f4c991ff096b194837be59b9ad68 Mon Sep 17 00:00:00 2001 From: Stan Padgett Date: Mon, 6 Nov 2023 16:49:24 -0500 Subject: [PATCH 1/3] proposed change v1 --- adafruit_veml7700.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adafruit_veml7700.py b/adafruit_veml7700.py index 658870e..2b637f4 100644 --- a/adafruit_veml7700.py +++ b/adafruit_veml7700.py @@ -193,6 +193,8 @@ 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: self.light_shutdown = False # Enable the ambient light sensor From 195411155203035b3563d5f2fc8d9f906fdd0336 Mon Sep 17 00:00:00 2001 From: Stan Padgett Date: Tue, 7 Nov 2023 22:09:08 -0500 Subject: [PATCH 2/3] 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: From 6012169258f3c066b654c79af34a6f17a7d51676 Mon Sep 17 00:00:00 2001 From: Stan Padgett Date: Wed, 8 Nov 2023 13:53:45 -0500 Subject: [PATCH 3/3] code change reformatted with black --- adafruit_veml7700.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_veml7700.py b/adafruit_veml7700.py index eb27909..635d5e2 100644 --- a/adafruit_veml7700.py +++ b/adafruit_veml7700.py @@ -196,7 +196,7 @@ def __init__(self, i2c_bus: I2C, address: int = 0x10) -> None: 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_gain = self.ALS_GAIN_1_8 # self.light_shutdown = False # Enable the ambient light sensor break