Skip to content

Commit 3adfd8a

Browse files
committed
Moved offset to simpletest
1 parent c5c1eda commit 3adfd8a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

adafruit_bme680.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@ class Adafruit_BME680:
142142
:param int refresh_rate: Maximum number of readings per second. Faster property reads
143143
will be from the previous reading."""
144144

145-
def __init__(self, *, refresh_rate=10, temp_offset=5):
145+
def __init__(self, *, refresh_rate=10):
146146
"""Check the BME680 was found, read the coefficients and enable the sensor for continuous
147147
reads."""
148-
149148
self._write(_BME680_REG_SOFTRESET, [0xB6])
150149
time.sleep(0.005)
151150

@@ -179,9 +178,6 @@ def __init__(self, *, refresh_rate=10, temp_offset=5):
179178
self._last_reading = 0
180179
self._min_refresh_time = 1 / refresh_rate
181180

182-
# Set up temperature offset
183-
self.temp_offset = temp_offset
184-
185181
@property
186182
def pressure_oversample(self):
187183
"""The oversampling for pressure sensor"""
@@ -235,7 +231,7 @@ def temperature(self):
235231
"""The compensated temperature in degrees celsius."""
236232
self._perform_reading()
237233
calc_temp = ((self._t_fine * 5) + 128) / 256
238-
return (calc_temp / 100) - self.temp_offset
234+
return calc_temp / 100
239235

240236
@property
241237
def pressure(self):

examples/bme680_simpletest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
bme680.sea_level_pressure = 1013.25
1212

1313
while True:
14-
print("\nTemperature: %0.1f C" % bme680.temperature)
14+
# You will usually have to add an offset to account for the temperature of
15+
# the sensor. This is usually around 5 degrees.
16+
print("\nTemperature: %0.1f C" % bme680.temperature - 5)
1517
print("Gas: %d ohm" % bme680.gas)
1618
print("Humidity: %0.1f %%" % bme680.humidity)
1719
print("Pressure: %0.3f hPa" % bme680.pressure)

0 commit comments

Comments
 (0)