From 532f84b2aa9bbae1c05857f38bd7991e637c8d1c Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 8 Jan 2019 11:00:04 -0500 Subject: [PATCH 1/2] set_iaq_humidity --- adafruit_sgp30.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/adafruit_sgp30.py b/adafruit_sgp30.py index 33a1235..e82725a 100755 --- a/adafruit_sgp30.py +++ b/adafruit_sgp30.py @@ -130,6 +130,15 @@ def set_iaq_baseline(self, eCO2, TVOC): # pylint: disable=invalid-name buffer += arr self._run_profile(["iaq_set_baseline", [0x20, 0x1e] + buffer, 0, 0.01]) + def set_iaq_humidity(self, rh): # pylint: disable=invalid-name + """Set the humidity for eCO2 and TVOC compensation algorithm""" + rh = int(rh * 256) + buffer = [] + for value in [rh]: + arr = [value >> 8, value & 0xFF] + arr.append(self._generate_crc(arr)) + buffer += arr + self._run_profile(["iaq_set_humidity", [0x20, 0x61] + buffer, 0, 0.01]) # Low level command functions From baa36210898d36cda5ed12dde233e2862ef2a61d Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 9 Jan 2019 14:29:26 -0500 Subject: [PATCH 2/2] Update adafruit_sgp30.py indicate units --- adafruit_sgp30.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_sgp30.py b/adafruit_sgp30.py index e82725a..e031a5c 100755 --- a/adafruit_sgp30.py +++ b/adafruit_sgp30.py @@ -130,11 +130,11 @@ def set_iaq_baseline(self, eCO2, TVOC): # pylint: disable=invalid-name buffer += arr self._run_profile(["iaq_set_baseline", [0x20, 0x1e] + buffer, 0, 0.01]) - def set_iaq_humidity(self, rh): # pylint: disable=invalid-name - """Set the humidity for eCO2 and TVOC compensation algorithm""" - rh = int(rh * 256) + def set_iaq_humidity(self, gramsPM3): # pylint: disable=invalid-name + """Set the humidity in g/m3 for eCO2 and TVOC compensation algorithm""" + tmp = int(gramsPM3 * 256) buffer = [] - for value in [rh]: + for value in [tmp]: arr = [value >> 8, value & 0xFF] arr.append(self._generate_crc(arr)) buffer += arr