Hello Robin, sorry that I need this time to answer. I use the hardware from Adafruit. In my initialization I configure the settings and the function bsec_sensor_control change this configuration. The most aspects of the code is from your exampels. I have tried each of the bsec_config_selectivity function but there is no big difference. How much time need the CO2 Value to get alternative to 500 or 400. This value is really important for me. The relevant code as follows. bool BME688_Init(I2C_HandleTypeDef *hi2c, uint8_t Slave_Address) { BME688_MCU.phi2c = hi2c; //Data for the BME Driver & Communication _bme68x.intf_ptr = (void*)(intptr_t) Slave_Address; _bme68x.intf = BME68X_I2C_INTF; _bme68x.amb_temp = 25; _bme68x.delay_us = delay_us; _bme68x.read = bme68x_i2c_read; _bme68x.write = bme68x_i2c_write; _timer_overflow_counter = 0; _timer_last_value = 0; _step = CONTROL_STEP; _bme68x_status = BME68X_OK; _bsec_status = BSEC_OK; _temp_offset = 5.0; _bme68x_status = bsec_init(); // Bsec Library initialization memset(&_bsec_bme_settings, 0, sizeof(_bsec_bme_settings)); memset(&_output, 0, sizeof(_output)); _step = CONTROL_STEP; last_meas_index = 0; _bme68x_status |= setConfig(bsec_config_selectivity); // BME688 vordefinierte Config wird geladen //_bme68x_status |= loadState(); _bme68x_status |= updateSubscription(BSEC_SAMPLE_RATE_HIGH_PERFORMANCE); // BME688 samplerate definition _bme68x_status |= bme68x_init(&_bme68x); // BME688 initialization if (_bsec_status < BSEC_OK) return false; //BME688 setting definition _bsec_bme_settings.op_mode = BME68X_PARALLEL_MODE; _bsec_bme_settings.humidity_oversampling = BME68X_OS_2X; _bsec_bme_settings.pressure_oversampling = BME68X_OS_16X; _bsec_bme_settings.temperature_oversampling = BME68X_OS_2X; _bsec_bme_settings.run_gas = BME68X_ENABLE; uint16_t temp_prof[10] = { 250, 100, 100, 100, 100, 100, 100, 250, 250, 250 }; // Heater temperature in degree Celsius uint16_t mul_prof[10] = { 2, 0, 10, 15, 2, 2, 2, 2, 2, 2 }; // Multiplier to the shared heater duration for(uint8_t i=0; i<(ARRAY_LEN(temp_prof));i++) _bsec_bme_settings.heater_temperature_profile[i]= temp_prof[i]; for(uint8_t j=0; j<(ARRAY_LEN(mul_prof));j++) _bsec_bme_settings.heater_duration_profile[j] = mul_prof[j]; _bsec_bme_settings.heater_profile_len = 10; setBme68xConfigParallel(); return true; } bool run(void) { n_fields = 0; tick = HAL_GetTick(); currTimeNs = 1000000 * (int64_t)tick; _op_mode = _bsec_bme_settings.op_mode; //del_period = bme68x_get_meas_dur(BME68X_PARALLEL_MODE, &conf, &_bme68x) + (heatr_conf.shared_heatr_dur * 1000); //_bme68x.delay_us(del_period, _bme68x.intf_ptr); //del = HAL_GetTick() - tick; if (currTimeNs >= _bsec_bme_settings.next_call) { _bsec_status = bsec_sensor_control(currTimeNs, &_bsec_bme_settings); if (_bsec_status < BSEC_OK) return false; switch(_bsec_bme_settings.op_mode) { case BME68X_FORCED_MODE: setBme68xConfigForced(); break; case BME68X_PARALLEL_MODE: if (_op_mode != _bsec_bme_settings.op_mode) { setBme68xConfigParallel(); } break; case BME68X_SLEEP_MODE: if (_op_mode != _bsec_bme_settings.op_mode) { setBme68xConfigSleep(); } break; } if (_bme68x_status < BME68X_OK) return false; { //_bme68x_status = bme68x_get_data(BME68X_PARALLEL_MODE, _bme68x_data, &n_fields, &_bme68x); _bme68x_status = bme68x_get_data(_op_mode, _bme68x_data, &n_fields, &_bme68x); for(uint8_t i = 0; i < n_fields; i++) { if (_bme68x_data[i].status & BME68X_GASM_VALID_MSK) { /* Measurement index check to track the first valid sample after operation mode change */ if(check_meas_idx == true ) { /* After changing the operation mode, Measurement index expected to be zero * however with considering the data miss case as well, condition shall be checked less * than last received measurement index */ if(last_meas_index == 0 || _bme68x_data[i].meas_index == 0 || _bme68x_data[i].meas_index < last_meas_index) { check_meas_idx = false; } else { continue; // Skip the invalid data samples or data from last duty cycle scan } } last_meas_index = _bme68x_data[i].meas_index; if(!processData(currTimeNs, &_bme68x_data[i])) { return false; } } } } } return true; }
... View more