diff --git a/bme680/__init__.py b/bme680/__init__.py index 4967bd3..62f6889 100644 --- a/bme680/__init__.py +++ b/bme680/__init__.py @@ -121,6 +121,8 @@ class BME680(BME680Data): self.data.status |= regs[14] & GASM_VALID_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: self.data.temperature = self._calc_temperature(adc_temp) self.ambient_temperature = self.data.temperature diff --git a/bme680/constants.py b/bme680/constants.py index 9b1345c..dc361d6 100644 --- a/bme680/constants.py +++ b/bme680/constants.py @@ -238,6 +238,7 @@ class FieldData: def __init__(self): # Contains new_data, gasm_valid & heat_stab self.status = None + self.heat_stable = False # The index of the heater profile used self.gas_index = None # Measurement index to track order diff --git a/livetest.py b/livetest.py index 1313cfb..8a4ede1 100644 --- a/livetest.py +++ b/livetest.py @@ -30,10 +30,14 @@ try: sensor.set_power_mode(bme680.FORCED_MODE) sensor.get_sensor_data() - for name in dir(sensor.data): - value = getattr(sensor.data, name) - if not name.startswith('_'): - print("{}: {}".format(name, value)) + if sensor.data.heat_stable: + print("{}".format(sensor.data.gas_resistance)) + + 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: pass