Browse Source

BMP280 wrapper: Clean up floating point operations

sbg
Lorenz Meier 9 years ago
parent
commit
c67907ffb2
  1. 6
      src/platforms/posix/drivers/df_bmp280_wrapper/df_bmp280_wrapper.cpp

6
src/platforms/posix/drivers/df_bmp280_wrapper/df_bmp280_wrapper.cpp

@ -169,7 +169,7 @@ int DfBmp280Wrapper::_publish(struct baro_sensor_data &data) @@ -169,7 +169,7 @@ int DfBmp280Wrapper::_publish(struct baro_sensor_data &data)
// TODO: verify this, it's just copied from the MS5611 driver.
// Constant for now
const float MSL_PRESSURE = 101325.0f;
const double MSL_PRESSURE_KPA = 101325.0 / 1000.0;
/* tropospheric properties (0-11km) for standard atmosphere */
const double T1 = 15.0 + 273.15; /* temperature at base height in Kelvin */
@ -178,10 +178,10 @@ int DfBmp280Wrapper::_publish(struct baro_sensor_data &data) @@ -178,10 +178,10 @@ int DfBmp280Wrapper::_publish(struct baro_sensor_data &data)
const double R = 287.05; /* ideal gas constant in J/kg/K */
/* current pressure at MSL in kPa */
double p1 = MSL_PRESSURE / 1000.0f;
double p1 = MSL_PRESSURE_KPA;
/* measured pressure in kPa */
double p = data.pressure_pa / 1000.0f;
double p = static_cast<double>(data.pressure_pa) / 1000.0;
/*
* Solve:

Loading…
Cancel
Save