forked

Fork of MPU9250_SPI by Mu kylong

Files at this revision

API Documentation at this revision

Comitter:
misodengaku
Date:
Wed Nov 29 06:29:21 2017 +0000
Parent:
11:084e8ba240c1
Commit message:
cast

Changed in this revision

MPU9250.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 084e8ba240c1 -r 1056a7f87bd0 MPU9250.cpp
--- a/MPU9250.cpp	Tue Jul 01 13:59:45 2014 +0000
+++ b/MPU9250.cpp	Wed Nov 29 06:29:21 2017 +0000
@@ -256,7 +256,7 @@
 
     bit_data=((int16_t)response[0]<<8)|response[1];
     data=(float)bit_data;
-    Temperature=(data/340)+36.53;
+    Temperature=((double)data/340)+36.53;
     deselect();
 }
 
@@ -361,7 +361,7 @@
     //Get temperature
     bit_data=((int16_t)response[i*2]<<8)|response[i*2+1];
     data=(float)bit_data;
-    Temperature=((data-21)/333.87)+21;
+    Temperature=(((double)data-21)/333.87)+21;
     //Get gyroscop value
     for(i=4; i<7; i++) {
         bit_data=((int16_t)response[i*2]<<8)|response[i*2+1];