Skip to content

add some comments about "refPressure" #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/SparkFunBME280.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,13 @@ float BME280::readFloatPressure( void )

}

//Sets the internal variable _referencePressure so the
// Sets the internal variable _referencePressure so the altitude is calculated properly.
// This is also known as "sea level pressure" and is in Pascals. The value is probably
// within 10% of 101325. This varies based on the weather:
// https://en.wikipedia.org/wiki/Atmospheric_pressure#Mean_sea-level_pressure
//
// if you are concerned about accuracy or precision, make sure to pull the
// "sea level pressure"value from a trusted source like NOAA.
void BME280::setReferencePressure(float refPressure)
{
_referencePressure = refPressure;
Expand All @@ -406,7 +412,13 @@ float BME280::readFloatAltitudeMeters( void )
{
float heightOutput = 0;

//heightOutput = ((float)-45846.2)*(pow(((float)readFloatPressure()/(float)_referencePressure), 0.190263) - (float)1);
// Getting height from a pressure reading is called the "international barometric height formula".
// The magic value of 44330.77 was adjusted in issue #30.
// There's also some discussion of it here: https://www.sparkfun.com/tutorials/253
// This calculation is NOT designed to work on non-Earthlike planets such as Mars or Venus;
// see NRLMSISE-00. That's why it is the "international" formula, not "interplanetary".
// Sparkfun is not liable for incorrect altitude calculations from this
// code on those planets. Interplanetary selfies are welcome, however.
heightOutput = ((float)-44330.77)*(pow(((float)readFloatPressure()/(float)_referencePressure), 0.190263) - (float)1); //Corrected, see issue 30
return heightOutput;

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy