Roqyun KO / DHT

Files at this revision

API Documentation at this revision

Comitter:
certvert
Date:
Mon Jan 07 10:57:07 2019 +0000
Parent:
3:6937e130feca
Commit message:
No change made.

Changed in this revision

DHT.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/DHT.cpp	Sat May 28 11:11:34 2016 +0000
+++ b/DHT.cpp	Mon Jan 07 10:57:07 2019 +0000
@@ -135,7 +135,7 @@
 
 float DHT::CalcTemperature()
 {
-    int v;
+    float v;
 
     switch (_DHTtype) {
         case DHT11:
@@ -143,12 +143,12 @@
             return float(v);
         case DHT22:
             v = DHT_data[2] & 0x7F;
-            v *= 256;
+            v *= 256.0f;
             v += DHT_data[3];
-            v /= 10;
+            v /= 10.0f;
             if (DHT_data[2] & 0x80)
                 v *= -1;
-            return float(v);
+            return v;
     }
     return 0;
 }