Support for BME280 Temperature Correction (#1062)
* Support for BME280 Temperature Correction The Spark Fun BME 280 library has support for Temperature correction, and this pull request implements the ability to apply a correction via a compiler directive ( BME280Correction ).
This commit is contained in:
1 parent
eaa7bc94b2
commit
94a7792863
3 files changed
+19
No files matched your search
@@ -107,6 +107,12 @@ void setupZsensorBME280() {
|
|||||||
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
|
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
|
||||||
mySensor.settings.humidOverSample = 1;
|
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)
|
delay(10); // Gives the Sensor enough time to turn on (The BME280 requires 2ms to start up)
|
||||||
|
|
||||||
int ret = mySensor.begin();
|
int ret = mySensor.begin();
|
||||||
|
|||||||
@@ -62,4 +62,16 @@ int BME280_i2c_addr = 0x76; // Bosch BME280 I2C Address
|
|||||||
int BME280_PIN_SDA = SDA; // PIN SDA
|
int BME280_PIN_SDA = SDA; // PIN SDA
|
||||||
int BME280_PIN_SCL = SCL; // PIN SCL
|
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
|
#endif
|
||||||
@@ -236,6 +236,7 @@ build_flags =
|
|||||||
'-DZsensorADC="ADC"'
|
'-DZsensorADC="ADC"'
|
||||||
'-DZsensorBH1750="BH1750"'
|
'-DZsensorBH1750="BH1750"'
|
||||||
'-DZsensorBME280="BME280"'
|
'-DZsensorBME280="BME280"'
|
||||||
|
'-DBME280Correction=-3.4'
|
||||||
'-DZsensorHTU21="HTU21"'
|
'-DZsensorHTU21="HTU21"'
|
||||||
'-DZsensorAHTx0="AHTx0"'
|
'-DZsensorAHTx0="AHTx0"'
|
||||||
'-DZsensorTSL2561="TSL2561"'
|
'-DZsensorTSL2561="TSL2561"'
|
||||||
|
|||||||
Reference in new issue
Block a user