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

BUG : return DHT_ERROR_CHECKSUM when temperature is negative. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

capswiz
Copy link

@capswiz 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.

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
Fix for DHT_ERROR_CHECKSUM with negative temperatures
@darcoto
Copy link
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants