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

Commit 7fa6ba8

Browse files
author
Craig Ringer
committed
Merge pull request #1 from nathanchantrell/master
Fix for DHT_ERROR_CHECKSUM with negative temperatures
2 parents f1c5b3a + f0b374a commit 7fa6ba8

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)