fix SHT never using HEAT

This commit is contained in:
Nicolò Balzarotti 2023-02-21 14:19:12 +01:00
parent 9840f4a788
commit e94994f4fb
1 changed files with 5 additions and 4 deletions

View File

@ -95,14 +95,14 @@ class SHT40(Sensor):
self.heat_every = every
if self.measure != "Temperature":
self.last_heat = perf_counter()
self.heatmode = adafruit_sht4x.Mode.HIGHHEAT_1S
# alternative: HIGHHEAT_1S
self.heatmode = adafruit_sht4x.Mode.LOWHEAT_100MS
self.standardmode = SHT40_DEFAULT
self.serial = hex(sht.serial_number)
# mode: adafruit_sht4x.Mode.string[sht.mode]
# Can also set the mode to enable heater
# sht.mode = adafruit_sht4x.Mode.LOWHEAT_100MS
# modes = [adafruit_sht4x.Mode.HIGHHEAT_1S,
# adafruit_sht4x.Mode.LOWHEAT_100MS,
# adafruit_sht4x.Mode.NOHEAT_HIGHPRECISION]
def is_temperature(self):
return self.measure == "Temperature"
@ -123,6 +123,7 @@ class SHT40(Sensor):
temperature, relative_humidity = sht.measurements
if reset:
self.reset_mode()
self.last_heat = perf_counter()
return (time, temperature if self.measure == 'Temperature' else relative_humidity)
class Sensors():