Skip to content

Commit d021a10

Browse files
committed
1 parent 19b32e1 commit d021a10

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ To read from the sensor:
6060

6161
.. code-block:: python
6262
63-
co2eq, tvoc = sgp30.iaq_measure()
64-
print("CO2eq = %d ppm \t TVOC = %d ppb" % (co2eq, tvoc))
63+
eCO2, TVOC = sgp30.iaq_measure()
64+
print("eCO2 = %d ppm \t TVOC = %d ppb" % (eCO2, TVOC))
6565
6666
6767
Contributing

adafruit_sgp30.py

+14-11
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,29 @@ def __init__(self, i2c, address=_SGP30_DEFAULT_I2C_ADDR):
7777

7878

7979
@property
80-
def tvoc(self):
80+
# pylint: disable=invalid-name
81+
def TVOC(self):
8182
"""Total Volatile Organic Compound in parts per billion."""
8283
return self.iaq_measure()[1]
8384

8485

8586
@property
86-
def baseline_tvoc(self):
87+
# pylint: disable=invalid-name
88+
def baseline_TVOC(self):
8789
"""Total Volatile Organic Compound baseline value"""
8890
return self.get_iaq_baseline()[1]
8991

9092

9193
@property
92-
def co2eq(self):
94+
# pylint: disable=invalid-name
95+
def eCO2(self):
9396
"""Carbon Dioxide Equivalent in parts per million"""
9497
return self.iaq_measure()[0]
9598

9699

97100
@property
98-
def baseline_co2eq(self):
101+
# pylint: disable=invalid-name
102+
def baseline_eCO2(self):
99103
"""Carbon Dioxide Equivalent baseline value"""
100104
return self.get_iaq_baseline()[0]
101105

@@ -106,22 +110,21 @@ def iaq_init(self):
106110
self._run_profile(["iaq_init", [0x20, 0x03], 0, 0.01])
107111

108112
def iaq_measure(self):
109-
"""Measure the CO2eq and TVOC"""
113+
"""Measure the eCO2 and TVOC"""
110114
# name, command, signals, delay
111115
return self._run_profile(["iaq_measure", [0x20, 0x08], 2, 0.05])
112116

113117
def get_iaq_baseline(self):
114-
"""Retreive the IAQ algorithm baseline for CO2eq and TVOC"""
118+
"""Retreive the IAQ algorithm baseline for eCO2 and TVOC"""
115119
# name, command, signals, delay
116120
return self._run_profile(["iaq_get_baseline", [0x20, 0x15], 2, 0.01])
117121

118-
119-
def set_iaq_baseline(self, co2eq, tvoc):
120-
"""Set the previously recorded IAQ algorithm baseline for CO2eq and TVOC"""
121-
if co2eq == 0 and tvoc == 0:
122+
def set_iaq_baseline(self, eCO2, TVOC): # pylint: disable=invalid-name
123+
"""Set the previously recorded IAQ algorithm baseline for eCO2 and TVOC"""
124+
if eCO2 == 0 and TVOC == 0:
122125
raise RuntimeError('Invalid baseline')
123126
buffer = []
124-
for value in [tvoc, co2eq]:
127+
for value in [TVOC, eCO2]:
125128
arr = [value >> 8, value & 0xFF]
126129
arr.append(self._generate_crc(arr))
127130
buffer += arr

examples/sgp30_simpletest.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
elapsed_sec = 0
1919

2020
while True:
21-
print("co2eq = %d ppm \t tvoc = %d ppb" % (sgp30.co2eq, sgp30.tvoc))
21+
print("eCO2 = %d ppm \t TVOC = %d ppb" % (sgp30.eCO2, sgp30.TVOC))
2222
time.sleep(1)
2323
elapsed_sec += 1
2424
if elapsed_sec > 10:
2525
elapsed_sec = 0
26-
print("**** Baseline values: co2eq = 0x%x, tvoc = 0x%x"
27-
% (sgp30.baseline_co2eq, sgp30.baseline_tvoc))
26+
print("**** Baseline values: eCO2 = 0x%x, TVOC = 0x%x"
27+
% (sgp30.baseline_eCO2, sgp30.baseline_TVOC))

0 commit comments

Comments
 (0)