Gbertaz / NonBlockingDallas

Arduino library for the DS18B20 temperature sensor. Avoid blocking the sketch while reading the sensor.
MIT License
11 stars 4 forks source link

Update NonBlockingDallas.cpp #2

Closed dzsoni closed 2 years ago

dzsoni commented 2 years ago

Error values from DallasTemperature.h.

dzsoni commented 2 years ago

Please review my suggestion. The DallasTemperature::getTempC and DallasTemperature::getTempF returns with DEVICE_DISCONNECTED_C (-127) and DEVICE_DISCONNECTED_F (-196.6) if we can't read the temp. Where does your 85.0 value come from? (DEVICE_DISCONNECTED_C i and F are defined in DallasTemperature.h.)

Gbertaz commented 2 years ago

Hi, thank you for the correction. The value 85.0 is wrong, my bad. However according to DallasTemperature Readme:

In case of temperature conversion problems (result is -85)

Should we check against -85 as well?

dzsoni commented 2 years ago

Tell the true, I don't know, but you can find many pages about this topc. 85.0 is the power-on reset value of the temperature register , and after power up, you must issue "requestTemperatures" in order to read valid temp. Many pople miss it or not let enought time to the conversion? thanks for the lib anyway :) https://forum.arduino.cc/t/why-does-this-fix-work-for-ds18b20-error-code-85/529580/2

Gbertaz commented 2 years ago

You are welcome, I hope you find the lib useful and thank you for participating. I will dig into this topic

ericnev commented 1 year ago

You are welcome, I hope you find the lib useful and thank you for participating. I will dig into this topic

I'm hitting this myself, and I'm curious what I'm doing wrong - the DallasTemperature library (blocking) is working as intended, but my callbacks return nothing but 85C after following the tutorial here.