Skip to content

Commit 7476793

Browse files
committed
sns(dht): dont overwrite dht22 sign bit
1 parent abbf721 commit 7476793

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

code/espurna/sensors/DHTSensor.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ float dht_temperature(DHTChipType type, std::array<uint8_t, 2> pair) {
132132
out = tmp;
133133
// fallback works both for the original chips and positive numbers
134134
} else {
135-
pair[0] &= MagnitudeMask;
136-
out = (pair[0] << 8) | pair[1];
135+
out = ((pair[0] & MagnitudeMask) << 8) | pair[1];
137136
if (pair[0] & SignMask) {
138137
out = -out;
139138
}

0 commit comments

Comments
 (0)