Hello innovaAlex,
Do you fully refer to the BME280 driver code in github? https://github.com/BoschSensortec/BME280_driver Driver code included data compensation.
/*! * @brief This API reads the pressure, temperature and humidity data from the * sensor, compensates the data and store it in the bme280_data structure * instance passed by the user. */ int8_t bme280_get_sensor_data(uint8_t sensor_comp, struct bme280_data *comp_data, struct bme280_dev *dev) { int8_t rslt;
/* Array to store the pressure, temperature and humidity data read from * the sensor */ uint8_t reg_data[BME280_P_T_H_DATA_LEN] = { 0 }; struct bme280_uncomp_data uncomp_data = { 0 };
/* Check for null pointer in the device structure*/ rslt = null_ptr_check(dev);
if ((rslt == BME280_OK) && (comp_data != NULL)) { /* Read the pressure and temperature data from the sensor */ rslt = bme280_get_regs(BME280_DATA_ADDR, reg_data, BME280_P_T_H_DATA_LEN, dev);
if (rslt == BME280_OK) { /* Parse the read data from the sensor */ bme280_parse_sensor_data(reg_data, &uncomp_data);
/* Compensate the pressure and/or temperature and/or * humidity data from the sensor */ rslt = bme280_compensate_data(sensor_comp, &uncomp_data, comp_data, &dev->calib_data); } } else { rslt = BME280_E_NULL_PTR; }
return rslt; }
... View more