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

Negative values saved in _temp as 6553.5 for -0.1, and increasing #14

Open
logan893 opened this issue Jan 7, 2018 · 0 comments
Open

Comments

@logan893
Copy link

logan893 commented Jan 7, 2018

Perhaps related to some compilator specific quirks. My compiled sketch is very old, from Arduino IDE 1.8.1, and has been running for a long time with a modified version of the idDHT22 library. The temperature storage section is identical to this library.

I suggest you change it to something like this, to avoid issues with compilator quirks messing with how unsigned int/short variables are handled.

_temp = word(_bits[2] & 0x7F, _bits[3]) * 0.1;
if (_bits[2] & 0x80) {
	_temp *= -1;
}

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

No branches or pull requests

1 participant