-

Files at this revision

API Documentation at this revision

Comitter:
aguscahya
Date:
Thu Apr 22 03:44:05 2021 +0000
Parent:
0:0b4c4632aeb0
Commit message:
-

Changed in this revision

BMP085.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 0b4c4632aeb0 -r bd3f19ce9849 BMP085.cpp
--- a/BMP085.cpp	Wed Dec 12 16:30:14 2012 +0000
+++ b/BMP085.cpp	Thu Apr 22 03:44:05 2021 +0000
@@ -50,7 +50,7 @@
 void BMP085::init()
 {
     get_cal_param();
-    set_oss(8); // standard over sampling (2 samples)
+    set_oss(1); // standard over sampling (2 samples)
     get_ut(); // initalize values
     get_up();
 }
@@ -188,14 +188,14 @@
     x1 = ((UT - AC6) * AC5) >> 15;
     x2 = (MC << 11) / (x1 + MD);
     B5 = x1 + x2;
-    temperature = ((B5 + 8) >> 4);
+    temperature = ((B5 + 8) >> 4)/10;
     return temperature;
 }
 
 int32_t BMP085::get_pressure()
 {
     get_up(); // get uncompressed pressure (uncompressed temperature must be called recently)
-
+    get_ut(); // uncompressed temperature
     B6 = B5 - 4000;
     X1 = (B2 * ((B6 * B6) >> 12)) >> 11;
     X2 = (AC2 * B6) >> 11;
@@ -222,9 +222,10 @@
 
 double BMP085::get_altitude_m()
 {
+    get_pressure();
     const double P0 = 1013.25; //pressure at sea level in hPa
     double pres_hpa = pressure / 100.0;
-    altitude = 44330.0 * (1.0 - pow((pres_hpa/P0), 0.190295));
+    altitude = (44330.0 * (1.0 - pow((pres_hpa/P0), 0.1903)));
     return altitude;
 }