Open marcel-bluestone opened 4 years ago
Also, since pressure is in Pascal, seaLevelPressure should also be in Pascal instead of millibar.
float DFRobot_BMP280::calAltitude(float seaLevelPressure, uint32_t pressure) { return 44330.8f * (1.0f - pow(float(pressure) / seaLevelPressure, 0.190266f)); }
In the Arduino examples config.ino and read_data.ino,
#define SEA_LEVEL_PRESSURE 1015.0f // sea level pressure
should be
#define SEA_LEVEL_PRESSURE 101325.0f // standard sea level pressure in Pa
In the current version of DFrobot_BMP280.cpp, the altitude values calculated in are rounded due to the fact that pressure is used as uint_32. If converted to float before calculation, the resulting altitude is more precise.
float DFRobot_BMP280::calAltitude(float seaLevelPressure, uint32_t pressure) { return 44330 * (1.0f - pow(pressure / 100 / seaLevelPressure, 0.1903)); }
should be
float DFRobot_BMP280::calAltitude(float seaLevelPressure, uint32_t pressure) { return 44330 * (1.0f - pow(float(pressure) / 100.0f / seaLevelPressure, 0.1903)); }