ds18b20 fix for temperature below zero

This commit is contained in:
sheinz 2016-11-25 21:42:50 +02:00
parent 5c885c7722
commit 3ea18e74da

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;