Merge pull request #295 from sheinz/fix/ds18b20_negative_temp

ds18b20 fix for temperature below zero
This commit is contained in:
Ruslan V. Uss 2016-11-26 04:25:18 +06:00 committed by GitHub
commit 4d00566421

View file

@ -174,7 +174,7 @@ bool ds18b20_read_scratchpad(int pin, ds18b20_addr_t addr, uint8_t *buffer) {
float ds18b20_read_temperature(int pin, ds18b20_addr_t addr) { float ds18b20_read_temperature(int pin, ds18b20_addr_t addr) {
uint8_t scratchpad[8]; uint8_t scratchpad[8];
int temp; int16_t temp;
if (!ds18b20_read_scratchpad(pin, addr, scratchpad)) { if (!ds18b20_read_scratchpad(pin, addr, scratchpad)) {
return NAN; return NAN;