金牌会员
 
- 积分
- 2106
- 金钱
- 2106
- 注册时间
- 2017-2-11
- 在线时间
- 307 小时
|
发表于 2020-12-15 18:52:55
|
显示全部楼层
- #define CONST_PF 0.1902630958 //(1/5.25588f) Pressure factor
- #define FIX_TEMP 25 // Fixed Temperature. ASL is a function of pressure and temperature, but as the temperature changes so much (blow a little towards the flie and watch it drop 5 degrees) it corrupts the ASL estimates.
- // TLDR: Adjusting for temp changes does more harm than good.
- /*
- * Converts pressure to altitude above sea level (ASL) in meters
- */
- static float bmp280PressureToAltitude(float* pressure/*, float* groundPressure, float* groundTemp*/)
- {
- if (*pressure>0)
- {
- return((pow((1015.7f/ *pressure),CONST_PF)-1.0f)*(FIX_TEMP+273.15f))/0.0065f;
- }
- else
- {
- return 0;
- }
- }
复制代码 |
|