Merge pull request #212 from cyberman54/development
BME680: bugfix pressure value conversion; feature temperature offset
This commit is contained in:
		
						commit
						c8696bfe1a
					
				| @ -8,6 +8,8 @@ static const char TAG[] = "main"; | |||||||
| bmeStatus_t bme_status; | bmeStatus_t bme_status; | ||||||
| TaskHandle_t BmeTask; | TaskHandle_t BmeTask; | ||||||
| 
 | 
 | ||||||
|  | float bme_offset = (float) BME_TEMP_OFFSET; | ||||||
|  | 
 | ||||||
| // --- Bosch BSEC library configuration ---
 | // --- Bosch BSEC library configuration ---
 | ||||||
| // 3,3V supply voltage; 3s max time between sensor_control calls; 4 days
 | // 3,3V supply voltage; 3s max time between sensor_control calls; 4 days
 | ||||||
| // calibration. Change this const if not applicable for your application (see
 | // 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
 |   // Switch on low-power mode and provide no temperature offset
 | ||||||
| 
 | 
 | ||||||
|   return_values_init ret = |   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); |                     user_delay_ms, state_load, config_load); | ||||||
| 
 |    | ||||||
|   if ((int)ret.bme680_status) { |   if ((int)ret.bme680_status) { | ||||||
|     ESP_LOGE(TAG, "Could not initialize BME680, error %d", |     ESP_LOGE(TAG, "Could not initialize BME680, error %d", | ||||||
|              (int)ret.bme680_status); |              (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.temperature = temperature; | ||||||
|   bme_status.humidity = humidity; |   bme_status.humidity = humidity; | ||||||
|   bme_status.pressure = pressure; |   bme_status.pressure = (pressure / 100.0); // conversion Pa -> hPa
 | ||||||
|   bme_status.iaq = iaq; |   bme_status.iaq = iaq; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ | |||||||
| 
 | 
 | ||||||
| // Payload send cycle and encoding | // Payload send cycle and encoding | ||||||
| #define SEND_SECS                       30      // payload send cycle [seconds/2] -> 60 sec. | #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 | // Set this to include BLE counting and vendor filter functions | ||||||
| #define VENDORFILTER                    1       // comment out if you want to count things, not people | #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 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] | #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 | // OTA settings | ||||||
| #define USE_OTA                         1       // Comment out to disable OTA update | #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] | #define WIFI_MAX_TRY                    5       // maximum number of wifi connect attempts for OTA update [default = 20] | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user