mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
Switch back to integer division in array indexing.
This commit is contained in:
parent
5bc0a5c796
commit
ce3190f65c
4
DHT.cpp
4
DHT.cpp
@ -194,11 +194,11 @@ boolean DHT::read(bool force) {
|
|||||||
_lastresult = false;
|
_lastresult = false;
|
||||||
return _lastresult;
|
return _lastresult;
|
||||||
}
|
}
|
||||||
data[i * 0.125] <<= 1;
|
data[i/8] <<= 1;
|
||||||
// Now compare the low and high cycle times to see if the bit is a 0 or 1.
|
// Now compare the low and high cycle times to see if the bit is a 0 or 1.
|
||||||
if (highCycles > lowCycles) {
|
if (highCycles > lowCycles) {
|
||||||
// High cycles are greater than 50us low cycle count, must be a 1.
|
// High cycles are greater than 50us low cycle count, must be a 1.
|
||||||
data[i * 0.125] |= 1;
|
data[i/8] |= 1;
|
||||||
}
|
}
|
||||||
// Else high cycles are less than (or equal to, a weird case) the 50us low
|
// Else high cycles are less than (or equal to, a weird case) the 50us low
|
||||||
// cycle count so this must be a zero. Nothing needs to be changed in the
|
// cycle count so this must be a zero. Nothing needs to be changed in the
|
||||||
|
Loading…
Reference in New Issue
Block a user