|  | 
| 40 | 40 |  * patent rights of the copyright holder. | 
| 41 | 41 |  * | 
| 42 | 42 |  * File		bme680_selftest.c | 
| 43 |  | - * @date	5 Jul 2017 | 
| 44 |  | - * @version	3.5.1 | 
|  | 43 | + * @date	10 Oct 2017 | 
|  | 44 | + * @version	3.5.2 | 
| 45 | 45 |  * | 
| 46 | 46 |  */ | 
| 47 | 47 | 
 | 
|  | 
| 53 | 53 | #include "bme680_selftest.h" | 
| 54 | 54 | 
 | 
| 55 | 55 | #define MIN_TEMPERATURE INT16_C(0)		/* 0 degree Celsius */ | 
| 56 |  | -#define MAX_TEMPERATURE INT16_C(4000) 	/* 40 degree Celsius */ | 
|  | 56 | +#define MAX_TEMPERATURE INT16_C(6000) 	/* 60 degree Celsius */ | 
| 57 | 57 | 
 | 
| 58 | 58 | #define MIN_PRESSURE UINT32_C(90000)	/* 900 hecto Pascals */ | 
| 59 | 59 | #define MAX_PRESSURE UINT32_C(110000) 	/* 1100 hecto Pascals */ | 
|  | 
| 63 | 63 | 
 | 
| 64 | 64 | #define HEATR_DUR	2000 | 
| 65 | 65 | #define N_MEAS		6 | 
| 66 |  | -#define LOW_TEMP	200 | 
|  | 66 | +#define LOW_TEMP	150 | 
| 67 | 67 | #define HIGH_TEMP 	350 | 
| 68 | 68 | 
 | 
| 69 | 69 | /*! | 
| @@ -124,9 +124,9 @@ int8_t bme680_self_test(struct bme680_dev *dev) | 
| 124 | 124 | 			if (rslt == BME680_OK) { | 
| 125 | 125 | 
 | 
| 126 | 126 | 				if (i % 2 == 0) | 
| 127 |  | -					t_dev.gas_sett.heatr_temp = LOW_TEMP; /* Lower temperature */ | 
| 128 |  | -				else | 
| 129 | 127 | 					t_dev.gas_sett.heatr_temp = HIGH_TEMP; /* Higher temperature */ | 
|  | 128 | +				else | 
|  | 129 | +					t_dev.gas_sett.heatr_temp = LOW_TEMP; /* Lower temperature */ | 
| 130 | 130 | 
 | 
| 131 | 131 | 				rslt = bme680_set_sensor_settings(settings_sel, &t_dev); | 
| 132 | 132 | 
 | 
| @@ -169,15 +169,16 @@ static int8_t analyze_sensor_data(struct bme680_field_data *data, uint8_t n_meas | 
| 169 | 169 | 		self_test_failed++; | 
| 170 | 170 | 
 | 
| 171 | 171 | 	for (i = 0; i < n_meas; i++) /* Every gas measurement should be valid */ | 
| 172 |  | -		if (!(data[i].status & (BME680_GASM_VALID_MSK | BME680_HEAT_STAB_MSK))) | 
|  | 172 | +		if (!(data[i].status & BME680_GASM_VALID_MSK)) | 
| 173 | 173 | 			self_test_failed++; | 
| 174 | 174 | 
 | 
| 175 |  | -	for (i = 2; i < n_meas; i += 2) { | 
| 176 |  | -		/* Invert formula to get integer values for centroid resistance, i.e. > 1 */ | 
| 177 |  | -		cent_res = (data[i - 2].gas_resistance + data[i].gas_resistance) / (2 * data[i - 1].gas_resistance); | 
| 178 |  | -	} | 
|  | 175 | +	/* 3 cycles heating are completed(HT1/LT1, HT2/LT2,HT3/LT3) | 
|  | 176 | +	   centroid gas ratio = 2*HT3 / (LT2+LT3) < 0.5*/ | 
|  | 177 | +	/* Invert formula to get integer values for centroid resistance */ | 
|  | 178 | +	if (n_meas >= 6) | 
|  | 179 | +		cent_res = (data[3].gas_resistance + data[5].gas_resistance) / (2 * data[4].gas_resistance); | 
| 179 | 180 | 
 | 
| 180 |  | -	if ((cent_res < 3) || (cent_res > 20)) /* 0.05 > cent_res^-1 < 0.03 */ | 
|  | 181 | +	if ((cent_res < 2)) /*cent_res^-1 < 0.5 */ | 
| 181 | 182 | 		self_test_failed++; | 
| 182 | 183 | 
 | 
| 183 | 184 | 	if (self_test_failed) | 
|  | 
0 commit comments