File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ float DHT::readTemperature(bool S, bool force) {
46
46
f = data[2 ] & 0x7F ;
47
47
f *= 256 ;
48
48
f += data[3 ];
49
- f /= 10 ;
49
+ f *= 0.1 ;
50
50
if (data[2 ] & 0x80 ) {
51
51
f *= -1 ;
52
52
}
@@ -60,11 +60,11 @@ float DHT::readTemperature(bool S, bool force) {
60
60
}
61
61
62
62
float DHT::convertCtoF (float c) {
63
- return c * 9 / 5 + 32 ;
63
+ return c * 1.8 + 32 ;
64
64
}
65
65
66
66
float DHT::convertFtoC (float f) {
67
- return (f - 32 ) * 5 / 9 ;
67
+ return (f - 32 ) * 0.55555 ;
68
68
}
69
69
70
70
float DHT::readHumidity (bool force) {
@@ -79,7 +79,7 @@ float DHT::readHumidity(bool force) {
79
79
f = data[0 ];
80
80
f *= 256 ;
81
81
f += data[1 ];
82
- f /= 10 ;
82
+ f *= 0.1 ;
83
83
break ;
84
84
}
85
85
}
@@ -194,11 +194,11 @@ boolean DHT::read(bool force) {
194
194
_lastresult = false ;
195
195
return _lastresult;
196
196
}
197
- data[i/ 8 ] <<= 1 ;
197
+ data[i * 0.125 ] <<= 1 ;
198
198
// Now compare the low and high cycle times to see if the bit is a 0 or 1.
199
199
if (highCycles > lowCycles) {
200
200
// High cycles are greater than 50us low cycle count, must be a 1.
201
- data[i/ 8 ] |= 1 ;
201
+ data[i * 0.125 ] |= 1 ;
202
202
}
203
203
// Else high cycles are less than (or equal to, a weird case) the 50us low
204
204
// cycle count so this must be a zero. Nothing needs to be changed in the
You can’t perform that action at this time.
0 commit comments