drivers/ds18: fix ds18 temperature conversion
This commit is contained in:
parent
d7ec96a91c
commit
7b64d35af5
@ -184,8 +184,8 @@ int ds18_read(const ds18_t *dev, int16_t *temperature)
|
|||||||
|
|
||||||
DEBUG("[DS18] Received byte: 0x%02x\n", b2);
|
DEBUG("[DS18] Received byte: 0x%02x\n", b2);
|
||||||
|
|
||||||
int32_t measurement = ((int16_t)(b2 << 8 | b1) * 625);
|
int32_t measurement = (int16_t)(b2 << 8 | b1);
|
||||||
*temperature = (int16_t)(measurement / 100);
|
*temperature = (int16_t)((100 * measurement) >> 4);
|
||||||
|
|
||||||
return DS18_OK;
|
return DS18_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user