From 49d5a9e76b481b0cd3d7c05b8193362c4ef6ed19 Mon Sep 17 00:00:00 2001 From: Chris Bartley Date: Fri, 18 Oct 2019 17:57:48 -0400 Subject: [PATCH 1/2] Added support for newer SGP30 chips which use a featureset value of 0x0022 --- adafruit_sgp30.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_sgp30.py b/adafruit_sgp30.py index e031a5c..10b9adc 100755 --- a/adafruit_sgp30.py +++ b/adafruit_sgp30.py @@ -51,7 +51,7 @@ # pylint: disable=bad-whitespace _SGP30_DEFAULT_I2C_ADDR = const(0x58) -_SGP30_FEATURESET = const(0x0020) +_SGP30_FEATURESETS = [const(0x0020), const(0x0022)] _SGP30_CRC8_POLYNOMIAL = const(0x31) _SGP30_CRC8_INIT = const(0xFF) @@ -71,7 +71,7 @@ def __init__(self, i2c, address=_SGP30_DEFAULT_I2C_ADDR): self.serial = self._i2c_read_words_from_cmd([0x36, 0x82], 0.01, 3) # get featureset featureset = self._i2c_read_words_from_cmd([0x20, 0x2f], 0.01, 1) - if featureset[0] != _SGP30_FEATURESET: + if featureset[0] not in _SGP30_FEATURESETS: raise RuntimeError('SGP30 Not detected') self.iaq_init() From 954ac57a37aa29b963b390b0a0a63fcaa4f98882 Mon Sep 17 00:00:00 2001 From: Chris Bartley Date: Wed, 6 Nov 2019 09:16:38 -0500 Subject: [PATCH 2/2] Made _SGP30_FEATURESETS a tuple --- adafruit_sgp30.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_sgp30.py b/adafruit_sgp30.py index 10b9adc..f32fc4a 100755 --- a/adafruit_sgp30.py +++ b/adafruit_sgp30.py @@ -51,7 +51,7 @@ # pylint: disable=bad-whitespace _SGP30_DEFAULT_I2C_ADDR = const(0x58) -_SGP30_FEATURESETS = [const(0x0020), const(0x0022)] +_SGP30_FEATURESETS = (0x0020, 0x0022) _SGP30_CRC8_POLYNOMIAL = const(0x31) _SGP30_CRC8_INIT = const(0xFF)