M5Unit-ENV 1.7.1 git rev:b34077f
Loading...
Searching...
No Matches
barometric_math.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
10#ifndef M5_UNIT_ENV_UTILITY_BAROMETRIC_MATH_HPP
11#define M5_UNIT_ENV_UTILITY_BAROMETRIC_MATH_HPP
12
13#include <cmath>
14
15namespace m5 {
16namespace unit {
17namespace barometric {
18
24inline float calculate_altitude(const float pressure_pa, const float sea_level_pa = 101325.0f)
25{
26 return 44330.0f * (1.0f - std::pow(pressure_pa / sea_level_pa, 1.0f / 5.255f));
27}
28
29} // namespace barometric
30} // namespace unit
31} // namespace m5
32
33#endif
Top level namespace of M5Stack.
Unit-related namespace.