M5Unit-ENV 1.7.1 git rev:b34077f
Loading...
Searching...
No Matches
barometric_math.hpp File Reference

Barometric math shared by pressure sensors (framework independent) More...

#include <cmath>

Go to the source code of this file.

Namespaces

namespace  m5
 Top level namespace of M5Stack.
 

Functions

float m5::unit::barometric::calculate_altitude (const float pressure_pa, const float sea_level_pa=101325.0f)
 Altitude (m) from a pressure and a reference sea-level pressure (both Pa)
 

Detailed Description

Barometric math shared by pressure sensors (framework independent)

Function Documentation

◆ calculate_altitude()

float m5::unit::barometric::calculate_altitude ( const float pressure_pa,
const float sea_level_pa = 101325.0f )
inline

Altitude (m) from a pressure and a reference sea-level pressure (both Pa)

Barometric formula (temperature-independent): h = 44330 * (1 - (p/p0)^(1/5.255)). Sea-level pressure defaults to the ICAO standard atmosphere (101325 Pa / 1013.25 hPa).