Commit 3e274ea3 authored by Melroy van den Berg's avatar Melroy van den Berg

clean-up pressure printfs

parent ee92efe9
Pipeline #1058 passed with stages
in 14 seconds
......@@ -437,7 +437,6 @@ private:
* @retval Compensated pressure data in float
*/
float compensate_pressure(const struct bme280_uncomp_data *uncomp_data);
//uint32_t compensate_pressure(const struct bme280_uncomp_data *uncomp_data);
/*!
* @brief This internal API is used to compensate the raw humidity data and
......
......@@ -348,9 +348,6 @@ bool BME280::SetSensorSettings(uint8_t desired_settings)
if (areSettingsChanged(OVERSAMPLING_SETTINGS, desired_settings))
{
result = set_osr_settings(desired_settings);
if(result == BME280_OK) {
printf("INFO: OSR settings written succesfully.\n");
}
}
/* Check if user wants to change filter and/or
......@@ -568,9 +565,6 @@ void BME280::bme280_parse_sensor_data(const uint8_t *reg_data, struct bme280_unc
data_msb = (uint32_t)reg_data[0] << 12;
data_lsb = (uint32_t)reg_data[1] << 4;
data_xlsb = (uint32_t)reg_data[2] >> 4;
printf("Pressure msb reg: %u\n", data_msb);
printf("Pressure lsb reg: %u\n", data_lsb);
printf("Pressure xlsb reg: %u\n", data_xlsb);
uncomp_data->pressure = data_msb | data_lsb | data_xlsb;
/* Store the parsed register values for temperature data */
......@@ -720,11 +714,7 @@ int8_t BME280::set_osr_press_temp_settings(uint8_t desired_settings, const struc
// osrs_p[2:0] = 1 0 1 (= 16x oversampling)
// Bit (mode) 1 0 (don't care for now)
printf("INFO: Press & temp OSR data: %u\n", reg_data);
// 2x temp & 16x press = 84 dec = 010 101 00
// 2x temp & 1x press = 68 dec = 010 001 00
result = bme280_set_regs(&reg_addr, &reg_data, 1);
}
......@@ -791,7 +781,6 @@ void BME280::fill_standby_settings(uint8_t *reg_data, const struct bme280_settin
*/
void BME280::fill_osr_press_settings(uint8_t *reg_data, const struct bme280_settings *settings)
{
printf("INFO: Set the pressure oversampling setting: %u\n", settings->osr_p);
*reg_data = BME280_SET_BITS(*reg_data, BME280_CTRL_PRESS, settings->osr_p);
}
......@@ -923,56 +912,6 @@ float BME280::compensate_temperature(const struct bme280_uncomp_data *uncomp_dat
return temperature;
}
/**
* \brief This internal API is used to compensate the raw pressure data
* \param[in] uncomp_data: Uncompesate data (incl. pressure)
* \return the compensated pressure type as hPa
*/
/*uint32_t BME280::compensate_pressure(const struct bme280_uncomp_data *uncomp_data)
{
int64_t var1;
int64_t var2;
int64_t var3;
int64_t var4;
uint32_t pressure;
uint32_t pressure_min = 3000000;
uint32_t pressure_max = 11000000;
var1 = ((int64_t)sensor_calib_data.t_fine) - 128000;
var2 = var1 * var1 * (int64_t)sensor_calib_data.dig_P6;
var2 = var2 + ((var1 * (int64_t)sensor_calib_data.dig_P5) * 131072);
var2 = var2 + (((int64_t)sensor_calib_data.dig_P4) * 34359738368);
var1 = ((var1 * var1 * (int64_t)sensor_calib_data.dig_P3) / 256) + ((var1 * ((int64_t)sensor_calib_data.dig_P2) * 4096));
var3 = ((int64_t)1) * 140737488355328;
var1 = (var3 + var1) * ((int64_t)sensor_calib_data.dig_P1) / 8589934592;
// To avoid divide by zero exception
if (var1 != 0)
{
var4 = 1048576 - uncomp_data->pressure;
var4 = (((var4 * INT64_C(2147483648)) - var2) * 3125) / var1;
var1 = (((int64_t)sensor_calib_data.dig_P9) * (var4 / 8192) * (var4 / 8192)) / 33554432;
var2 = (((int64_t)sensor_calib_data.dig_P8) * var4) / 524288;
var4 = ((var4 + var1 + var2) / 256) + (((int64_t)sensor_calib_data.dig_P7) * 16);
pressure = (uint32_t)(((var4 / 2) * 100) / 128);
if (pressure < pressure_min)
{
pressure = pressure_min;
}
else if (pressure > pressure_max)
{
pressure = pressure_max;
}
}
else
{
pressure = pressure_min;
}
printf("DEBUG: Compensated pressure value: %u\n", pressure);
return pressure;
}*/
float BME280::compensate_pressure(const struct bme280_uncomp_data *uncomp_data)
{
int32_t var1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment