Skip to content

Commit 00f4455

Browse files
authored
Merge pull request #20 from Airviz/multiple-featureset-values
Added support for newer SGP30 chips which use a featureset value of 0x0022
2 parents ad4a6a6 + 954ac57 commit 00f4455

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_sgp30.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
# pylint: disable=bad-whitespace
5353
_SGP30_DEFAULT_I2C_ADDR = const(0x58)
54-
_SGP30_FEATURESET = const(0x0020)
54+
_SGP30_FEATURESETS = (0x0020, 0x0022)
5555

5656
_SGP30_CRC8_POLYNOMIAL = const(0x31)
5757
_SGP30_CRC8_INIT = const(0xFF)
@@ -71,7 +71,7 @@ def __init__(self, i2c, address=_SGP30_DEFAULT_I2C_ADDR):
7171
self.serial = self._i2c_read_words_from_cmd([0x36, 0x82], 0.01, 3)
7272
# get featureset
7373
featureset = self._i2c_read_words_from_cmd([0x20, 0x2f], 0.01, 1)
74-
if featureset[0] != _SGP30_FEATURESET:
74+
if featureset[0] not in _SGP30_FEATURESETS:
7575
raise RuntimeError('SGP30 Not detected')
7676
self.iaq_init()
7777

0 commit comments

Comments
 (0)