Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix negative temperatures for DHT22 #16

Merged
merged 1 commit into from
Jan 2, 2018

Conversation

danielfaust
Copy link
Contributor

This commit fixes issue #14
The MSB carries the sign information, which is filtered with & 0x8000. If the flag is present, the remainder will get multiplied by -1.
All the remaining bits contain the value and are filtered with & 0x7FFF.

This commit fixes issue winlinvip#14
The MSB carries the sign information, which is filtered with `& 0x8000`. If the flag is present, the remainder will get multiplied by `-1`.
All the remaining bits contain the value and are filtered with `& 0x7FFF`.
@winlinvip
Copy link
Owner

👍

@winlinvip winlinvip merged commit 3c63797 into winlinvip:master Jan 2, 2018
@winlinvip
Copy link
Owner

Release 1.0.8.

@winlinvip
Copy link
Owner

It seems that you only fixed for DHT22, not for DHT11? Could you please fix it for DHT11 at https://github.com/winlinvip/SimpleDHT/blob/master/SimpleDHT.cpp#L112 ?

@danielfaust
Copy link
Contributor Author

danielfaust commented Jan 2, 2018

I don't have a DHT11 to test with. But since the DHT11 only works with temperatures equal to or above 0 °C, I think that sign flag never gets set. I preferred not to touch that code.

Good for 0-50°C temperature readings ±2°C accuracy

@winlinvip
Copy link
Owner

👌 Agreed, I will release a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants