File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -378,3 +378,23 @@ float Adafruit_BME280::readAltitude(float seaLevel)
378
378
float atmospheric = readPressure () / 100 .0F ;
379
379
return 44330.0 * (1.0 - pow (atmospheric / seaLevel, 0.1903 ));
380
380
}
381
+
382
+ /* *************************************************************************/
383
+ /* !
384
+ Calculates the pressure at sea level (in hPa) from the specified altitude
385
+ (in meters), and atmospheric pressure (in hPa).
386
+ @param altitude Altitude in meters
387
+ @param atmospheric Atmospheric pressure in hPa
388
+ */
389
+ /* *************************************************************************/
390
+ float Adafruit_BME280::seaLevelForAltitude (float altitude, float atmospheric)
391
+ {
392
+ // Equation taken from BMP180 datasheet (page 17):
393
+ // http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
394
+
395
+ // Note that using the equation from wikipedia can give bad results
396
+ // at high altitude. See this thread for more information:
397
+ // http://forums.adafruit.com/viewtopic.php?f=22&t=58064
398
+
399
+ return atmospheric / pow (1.0 - (altitude/44330.0 ), 5.255 );
400
+ }
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ class Adafruit_BME280
135
135
float readPressure (void );
136
136
float readHumidity (void );
137
137
float readAltitude (float seaLevel);
138
+ float seaLevelForAltitude (float altitude, float atmospheric);
138
139
139
140
private:
140
141
You can’t perform that action at this time.
0 commit comments