Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for BME280 Temperature Correction #1062

Merged
merged 6 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions main/ZsensorBME280.ino
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ void setupZsensorBME280() {
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
mySensor.settings.humidOverSample = 1;

// tempCorrection - Correction in celcius of temperature reported by bme280 sensor. Both Celcius and Farenheit temperatures are adjusted.
// -------------------------
// Value is a float
// ie Compiler Directive '-DBME280Correction=-3.4'
mySensor.settings.tempCorrection = BME280Correction;

delay(10); // Gives the Sensor enough time to turn on (The BME280 requires 2ms to start up)

int ret = mySensor.begin();
Expand Down
12 changes: 12 additions & 0 deletions main/config_BME280.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,16 @@ int BME280_i2c_addr = 0x76; // Bosch BME280 I2C Address
int BME280_PIN_SDA = SDA; // PIN SDA
int BME280_PIN_SCL = SCL; // PIN SCL

// Temperature correction for BME280 devices

#ifndef BME280Correction

// BME280Correction - Correction in celcius of temperature reported by bme280 sensor. Both Celcius and Farenheit temperatures are adjusted.
// -------------------------
// Value is a float
// ie Compiler Directive '-DBME280Correction=-3.4'

# define BME280Correction 0
#endif

#endif
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ build_flags =
'-DZsensorADC="ADC"'
'-DZsensorBH1750="BH1750"'
'-DZsensorBME280="BME280"'
'-DBME280Correction=-3.4'
'-DZsensorHTU21="HTU21"'
'-DZsensorAHTx0="AHTx0"'
'-DZsensorTSL2561="TSL2561"'
Expand Down