1
0
mirror of https://github.com/cmur2/python-bme680.git synced 2024-12-22 22:54:29 +01:00

Added heat_stable flag

This commit is contained in:
Phil Howard 2017-10-17 10:47:31 +01:00
parent cd3649a74f
commit 306fc84cb5
3 changed files with 11 additions and 4 deletions

View File

@ -121,6 +121,8 @@ class BME680(BME680Data):
self.data.status |= regs[14] & GASM_VALID_MSK self.data.status |= regs[14] & GASM_VALID_MSK
self.data.status |= regs[14] & HEAT_STAB_MSK self.data.status |= regs[14] & HEAT_STAB_MSK
self.data.heat_stable = (self.data.status & HEAT_STAB_MSK) > 0
if self.data.status & NEW_DATA_MSK: if self.data.status & NEW_DATA_MSK:
self.data.temperature = self._calc_temperature(adc_temp) self.data.temperature = self._calc_temperature(adc_temp)
self.ambient_temperature = self.data.temperature self.ambient_temperature = self.data.temperature

View File

@ -238,6 +238,7 @@ class FieldData:
def __init__(self): def __init__(self):
# Contains new_data, gasm_valid & heat_stab # Contains new_data, gasm_valid & heat_stab
self.status = None self.status = None
self.heat_stable = False
# The index of the heater profile used # The index of the heater profile used
self.gas_index = None self.gas_index = None
# Measurement index to track order # Measurement index to track order

View File

@ -30,10 +30,14 @@ try:
sensor.set_power_mode(bme680.FORCED_MODE) sensor.set_power_mode(bme680.FORCED_MODE)
sensor.get_sensor_data() sensor.get_sensor_data()
for name in dir(sensor.data): if sensor.data.heat_stable:
value = getattr(sensor.data, name) print("{}".format(sensor.data.gas_resistance))
if not name.startswith('_'):
print("{}: {}".format(name, value)) print("{}".format(sensor.data.temperature))
#for name in dir(sensor.data):
# value = getattr(sensor.data, name)
# if not name.startswith('_'):
# print("{}: {}".format(name, value))
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass