BME680: bugfix pressure value conversion; feature temperature offset

This commit is contained in:
Klaus K Wilting 2018-11-26 16:12:41 +01:00
parent 4da2260852
commit d5565c99e6
2 changed files with 9 additions and 4 deletions

View File

@ -8,6 +8,8 @@ static const char TAG[] = "main";
bmeStatus_t bme_status;
TaskHandle_t BmeTask;
float bme_offset = (float) BME_TEMP_OFFSET;
// --- Bosch BSEC library configuration ---
// 3,3V supply voltage; 3s max time between sensor_control calls; 4 days
// calibration. Change this const if not applicable for your application (see
@ -55,9 +57,9 @@ int bme_init(void) {
// Switch on low-power mode and provide no temperature offset
return_values_init ret =
bsec_iot_init(BSEC_SAMPLE_RATE_LP, 0.0f, i2c_write, i2c_read,
bsec_iot_init(BSEC_SAMPLE_RATE_LP, bme_offset, i2c_write, i2c_read,
user_delay_ms, state_load, config_load);
if ((int)ret.bme680_status) {
ESP_LOGE(TAG, "Could not initialize BME680, error %d",
(int)ret.bme680_status);
@ -79,7 +81,7 @@ void output_ready(int64_t timestamp, float iaq, uint8_t iaq_accuracy,
bme_status.temperature = temperature;
bme_status.humidity = humidity;
bme_status.pressure = pressure;
bme_status.pressure = (pressure / 100.0); // conversion Pa -> hPa
bme_status.iaq = iaq;
}

View File

@ -11,7 +11,7 @@
// Payload send cycle and encoding
#define SEND_SECS 30 // payload send cycle [seconds/2] -> 60 sec.
#define PAYLOAD_ENCODER 2 // payload encoder: 1=Plain, 2=Packed, 3=CayenneLPP dynamic, 4=CayenneLPP packed
#define PAYLOAD_ENCODER 3 // payload encoder: 1=Plain, 2=Packed, 3=CayenneLPP dynamic, 4=CayenneLPP packed
// Set this to include BLE counting and vendor filter functions
#define VENDORFILTER 1 // comment out if you want to count things, not people
@ -70,6 +70,9 @@
#define DISPLAYREFRESH_MS 40 // OLED refresh cycle in ms [default = 40] -> 1000/40 = 25 frames per second
#define HOMECYCLE 30 // house keeping cycle in seconds [default = 30 secs]
// Settings for BME680 environmental sensor (if present)
#define BME_TEMP_OFFSET 5.0f // Offset sensor on chip temp <-> ambient temp [default = 5°C]
// OTA settings
#define USE_OTA 1 // Comment out to disable OTA update
#define WIFI_MAX_TRY 5 // maximum number of wifi connect attempts for OTA update [default = 20]