Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.

Commit f0b374a

Browse files
Fix for negative temperatures
1 parent f1c5b3a commit f0b374a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

DHT22.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ DHT22_ERROR_t DHT22::readData()
210210
{
211211
// Below zero, non standard way of encoding negative numbers!
212212
// Convert to native negative format.
213-
currentTemperature &= 0x7FFF;
214-
_lastTemperature = -currentTemperature;
213+
_lastTemperature = -currentTemperature & 0x7FFF;
215214
}
216215
else
217216
{

0 commit comments

Comments
 (0)