From e94994f4fb79d14fd93960b31a844c3101fff7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Balzarotti?= Date: Tue, 21 Feb 2023 14:19:12 +0100 Subject: [PATCH] fix SHT never using HEAT --- sensors.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sensors.py b/sensors.py index 4ca3293..2824d98 100644 --- a/sensors.py +++ b/sensors.py @@ -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():