BUG : return DHT_ERROR_CHECKSUM when temperature is negative. #1

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

capswiz commented Dec 30, 2011

So I removed "currentTemperature &= 0x7FFF" line 208 and put "& 0x7FFF" in the expression line 209.
Now it works with negative temperatures.

BUG : return DHT_ERROR_CHECKSUM when temperature is negative.
So I removed "currentTemperature &= 0x7FFF" line 208 and put "& 0x7FFF" in the expression line 209.
Now it works with negative temperatures.

nethoncho pushed a commit that referenced this pull request Mar 25, 2013

Merge pull request #1 from nathanchantrell/master
Fix for DHT_ERROR_CHECKSUM with negative temperatures
Contributor

darcoto commented Jan 25, 2014

Suggested fix (from pull request) is not accurate for me because the unary minus will be performed before the &
The right code must be:
_lastTemperature = -(currentTemperature & 0x7FFF);
Now it work fine for my instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment