ds18b20 fix for temperature below zero
This commit is contained in:
parent
5c885c7722
commit
3ea18e74da
1 changed files with 12 additions and 12 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue