mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
new temperature deserialistation for DHT22
This commit is contained in:
parent
61ffee54ba
commit
daf4c86055
7
DHT.cpp
7
DHT.cpp
@ -109,11 +109,8 @@ float DHT::readTemperature(bool S, bool force) {
|
|||||||
break;
|
break;
|
||||||
case DHT22:
|
case DHT22:
|
||||||
case DHT21:
|
case DHT21:
|
||||||
f = ((word)(data[2] & 0x7F)) << 8 | data[3];
|
int16_t t = ((int16_t)data[2] << 8) | data[3];
|
||||||
f *= 0.1;
|
f = t * 0.1;
|
||||||
if (data[2] & 0x80) {
|
|
||||||
f *= -1;
|
|
||||||
}
|
|
||||||
if (S) {
|
if (S) {
|
||||||
f = convertCtoF(f);
|
f = convertCtoF(f);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user