Vuzi / raspi-sensors

Deprecated - Nodejs C++ plugin, allowing to easily read data from raspberryPi's sensors.
https://www.npmjs.com/package/raspi-sensors
Apache License 2.0
26 stars 3 forks source link

Can't get negative values from DHT22 temperature sensor #7

Closed oxyo closed 8 years ago

oxyo commented 8 years ago

Very good library, but there is a problem with DHT22 implementation. When temperature drops below 0, there is no possibility to get negative temperature values. Your library simply returns 0. It will be very nice if you would fix that.

Vuzi commented 8 years ago

Okay, so there is actually an error when the sign bit is set to 1 (i.e. for negative numbers). I'll fix it right now

Vuzi commented 8 years ago

Okay, so this should now works perfectly, and I've also update the npm of the project

oxyo commented 8 years ago

Hmm... Can't install any more from version 0.2.9 getting error:

install.sh: line 2: $'\r': command not found
Interactive builder for raspi-sensor. For more information feel free to visit https://github.com/Vuzi/raspi-sensor
install.sh: line 4: $'\r': command not found
install.sh: line 8: syntax error near unexpected token $'in\r''
install.sh: line 8:     case $gpio in

version 0.2.8 installation works ok, but no negative values :)

FlorianWendelborn commented 8 years ago

Looks like a CRLF issue. @Vuzi are you developing on Windows? If yes then please never use CRLF, it leads to really weird bugs on UNIX systems.

Vuzi commented 8 years ago

I work both on Linux and Windows, and I may have edited the file in Windows.. but that's really strange since I did not change anything in the install.sh script between versions 2.8 and 2.9/2.10 (last change was with version 2.4)

I'll look into it as soon as I can test it with my Raspberry

Vuzi commented 8 years ago

I've tried on my Ubuntu, and the script works fine, with no CRLF. I've added a gitattributes file to enforce LF line in any sh file, and re-publish to npm from a Linux.

Can you try to run the 0.2.11 ? And if it fails, to git clone then manually run the ./install.sh script ?