Moved offset to simpletest

This commit is contained in:
dherrada 2020-07-27 09:37:30 -04:00
parent c5c1edaca9
commit 3adfd8a151
2 changed files with 5 additions and 7 deletions

View file

@ -142,10 +142,9 @@ class Adafruit_BME680:
:param int refresh_rate: Maximum number of readings per second. Faster property reads
will be from the previous reading."""
def __init__(self, *, refresh_rate=10, temp_offset=5):
def __init__(self, *, refresh_rate=10):
"""Check the BME680 was found, read the coefficients and enable the sensor for continuous
reads."""
self._write(_BME680_REG_SOFTRESET, [0xB6])
time.sleep(0.005)
@ -179,9 +178,6 @@ class Adafruit_BME680:
self._last_reading = 0
self._min_refresh_time = 1 / refresh_rate
# Set up temperature offset
self.temp_offset = temp_offset
@property
def pressure_oversample(self):
"""The oversampling for pressure sensor"""
@ -235,7 +231,7 @@ class Adafruit_BME680:
"""The compensated temperature in degrees celsius."""
self._perform_reading()
calc_temp = ((self._t_fine * 5) + 128) / 256
return (calc_temp / 100) - self.temp_offset
return calc_temp / 100
@property
def pressure(self):

View file

@ -11,7 +11,9 @@ bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c, debug=False)
bme680.sea_level_pressure = 1013.25
while True:
print("\nTemperature: %0.1f C" % bme680.temperature)
# You will usually have to add an offset to account for the temperature of
# the sensor. This is usually around 5 degrees.
print("\nTemperature: %0.1f C" % bme680.temperature - 5)
print("Gas: %d ohm" % bme680.gas)
print("Humidity: %0.1f %%" % bme680.humidity)
print("Pressure: %0.3f hPa" % bme680.pressure)