I have multiple BMP280 sensors and using a cpp library all get the measurements very close and in line with online data.
Once I added your library into the mix the pressure is reported much lower than expected.
Your algorithm might dive the values too early resulting in data loos
see the algorithm I use in C here:
int64_t var1, var2, p;
I have multiple BMP280 sensors and using a cpp library all get the measurements very close and in line with online data. Once I added your library into the mix the pressure is reported much lower than expected. Your algorithm might dive the values too early resulting in data loos
see the algorithm I use in C here: int64_t var1, var2, p;
int32_t adc_P = I2C_read24_reg(bmp280_i2caddr, BMP280_REGISTER_PRESSUREDATA); adc_P >>= 4;
var1 = ((int64_t)bmp280_t_fine) - 128000; var2 = var1 var1 (int64_t)_bmp280_calib.dig_P6; var2 = var2 + ((var1 (int64_t)_bmp280_calib.dig_P5) << 17); var2 = var2 + (((int64_t)_bmp280_calib.dig_P4) << 35); var1 = ((var1 var1 (int64_t)_bmp280_calib.dig_P3) >> 8) + ((var1 (int64_t)_bmp280_calib.dig_P2) << 12); var1 = (((((int64_t)1) << 47) + var1)) * ((int64_t)_bmp280_calib.dig_P1) >> 33;
if (var1 == 0) { return 0; // avoid exception caused by division by zero } p = 1048576 - adc_P; p = (((p << 31) - var2) 3125) / var1; var1 = (((int64_t)_bmp280_calib.dig_P9) (p >> 13) (p >> 13)) >> 25; var2 = (((int64_t)_bmp280_calib.dig_P8) p) >> 19;
p = ((p + var1 + var2) >> 8) + (((int64_t)_bmp280_calib.dig_P7) << 4); return (float)p / 256;