bf15299cea
* DHT module: fix the handling of negative temps. The macro handling the conversion from the 2 bytes buffer to a double was handling negative values by checking the sign bit and taking the negative value of the number minus the sign bit. Unfortunately this does not work as the negative values are represented in 1's complement, so for instance -1 was becoming -32767 * +1 = b0000_0000_0000_ 0001 * -1 = 1111_1111_1111_1111 This replace the spacial code with a signed 16 bits value. * Refactoring: removes some code duplication. * Fixed the conversion of the 8/16 bits values Co-authored-by: Marco Dondero <marco@dondero.eu> |
||
---|---|---|
.. | ||
Makefile | ||
dht.c | ||
dht.h |