Skip to content

Commit 58152bd

Browse files
authored
Update adafruit_sgp30.py
1 parent a5b2858 commit 58152bd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

adafruit_sgp30.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,16 @@ def set_iaq_baseline(self, eCO2, TVOC): # pylint: disable=invalid-name
130130
buffer += arr
131131
self._run_profile(["iaq_set_baseline", [0x20, 0x1e] + buffer, 0, 0.01])
132132

133-
def set_iaq_humidity(self, phum): # pylint: disable=invalid-name
133+
def set_iaq_humidity(self, rh): # pylint: disable=invalid-name
134134
"""Set the humidity for eCO2 and TVOC compensation algorithm"""
135-
if phum == 0:
136-
raise RuntimeError('Invalid humidity')
135+
rh = int(rh * 256)
137136
buffer = []
138-
for value in [phum]:
137+
for value in [rh]:
139138
arr = [value >> 8, value & 0xFF]
140139
arr.append(self._generate_crc(arr))
141140
buffer += arr
142141
self._run_profile(["iaq_set_humidity", [0x20, 0x61] + buffer, 0, 0.01])
143142

144-
145143
# Low level command functions
146144

147145
def _run_profile(self, profile):

0 commit comments

Comments
 (0)