Already found some bugs
Wish I could be writing this in rust
This commit is contained in:
@@ -24,8 +24,8 @@ dht22_error dht22_read() {
|
|||||||
if (data[2] & 0x80) {
|
if (data[2] & 0x80) {
|
||||||
_dht22_temperature = -1 * _dht22_temperature;
|
_dht22_temperature = -1 * _dht22_temperature;
|
||||||
}
|
}
|
||||||
uint8_t checksum_val = (data[0] + data[1] + data[2] + data[2]) & 0xff;
|
uint8_t checksum_val = (data[0] + data[1] + data[2] + data[3]) & 0xff;
|
||||||
if (checksum_val != data[5]) {
|
if (checksum_val != data[4]) {
|
||||||
_dht22_relative_humidity = UINT16_MAX;
|
_dht22_relative_humidity = UINT16_MAX;
|
||||||
_dht22_temperature = INT16_MIN;
|
_dht22_temperature = INT16_MIN;
|
||||||
return DHT22_CHECKSUM_ERROR;
|
return DHT22_CHECKSUM_ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user