adafruit / Adafruit_CircuitPython_SHT31D

CircuitPython driver for the SHT31-D temperature and humidity sensor
MIT License
20 stars 18 forks source link

add temperature_and_relative_humidity property #8

Closed karolzlot closed 6 years ago

karolzlot commented 6 years ago

& better variables readibility & one comment fix

temperature_and_relative_humidity
with this parameter we can call sth31d 2x less times if we need both temp & humidity anyway

ladyada commented 6 years ago

hiya thank you for the pull request, we want to stick to our consistant naming across all sensors, keeping the temperature/humidity properties separate & not introducing a new property - even though it is slower the way we do it :)

tannewt commented 6 years ago

I agree with @ladyada that we shouldn't add this new combination property.

Instead, we could cache the values for a short period of time. We could also try shortening the sleep in the read to make it faster to read overall. @jerryneedell might know why it's half a second.

I'm closing this for now but we can still discuss alternatives on this PR.

jerryneedell commented 6 years ago

I don't recall why this was set to .5 seconds. In the Arduino driver it is 20ms. We can certainly try lowering it. We also could do something like the dht22 where it only does a new reading after a preset elapsed time. https://github.com/adafruit/Adafruit_CircuitPython_DHT/blob/master/adafruit_dht.py#L173 This was implemented because the dht22 cannot be read quickly. If the SHT31D can be read much faster then it may not be necessary unless we want to be able to provide reading of both temperature and humidity from the same sample.

karolzlot commented 6 years ago

Please have a look at this repo: https://github.com/ralf1070/Adafruit_Python_SHT31