adafruit / Adafruit-BMP085-Library

A powerful but easy to use BMP085/BMP180 Arduino library
http://www.adafruit.com/products/1603
233 stars 194 forks source link

Add function for calculating pressure at sea level #7

Closed sphh closed 10 years ago

sphh commented 11 years ago

I missed a function to calculate the pressure at sea level if the the altitude is known.

Adafruit_BMP085.h:

int32_t readSealevelpressure(float altitude = 0); // std atmosphere

Adafruit_BMP085.c:

int32_t Adafruit_BMP085::readSealevelpressure(float altitude) { int32_t sealevelPressure;

float pressure = readPressure();

sealevelPressure = (int32_t)(pressure / pow(1.0-altitude/44330, 5.255));

return sealevelPressure; }

tdicola commented 10 years ago

Thanks for the suggestion and apologies it couldn't be integrated sooner. I just committed a change to add this function and document it in the example. Thanks again for the suggestion!