@@ -29,6 +29,8 @@ BME680Controller::BME680Controller() {
2929 this ->hum_corr = 0.0 ;
3030 this ->gas_lower_limit = 10000 ; // Bad air quality limit
3131 this ->gas_upper_limit = 300000 ; // Good air quality limit
32+ this ->coreMode = Core;
33+ this ->core = 0 ;
3234#ifdef ENABLE_NATIVE_HAP
3335 this ->ishap =true ;
3436 this ->hapservice_temp =NULL ;
@@ -171,7 +173,10 @@ void BME680Controller::run() {
171173 command newcmd;
172174 newcmd.mode = BME680Measure;
173175 this ->meassure (newcmd.state );
176+
174177#ifdef BME680CONTROLLER_DEBUG
178+ // DBG_OUTPUT_PORT.println("Start delay test");
179+ // delay(30000);
175180 DBG_OUTPUT_PORT.print (" BME680Controller->" );
176181 DBG_OUTPUT_PORT.print (" Temperature in Celsius : " );
177182 DBG_OUTPUT_PORT.print (newcmd.state .temp );
@@ -226,6 +231,12 @@ void BME680Controller::meassure(BME680State& state) {
226231 state.gas_resistance = ReadGasReference ();
227232 state.gas = getpsevdoIaqGasScore (state.gas_resistance );
228233 state.last_measure_ms = millis ();
234+ #ifdef BME680CONTROLLER_DEBUG
235+ DBG_OUTPUT_PORT.print (" gas_resistance" );
236+ DBG_OUTPUT_PORT.println (state.gas_resistance );
237+ DBG_OUTPUT_PORT.print (" gas" );
238+ DBG_OUTPUT_PORT.println (state.gas );
239+ #endif
229240// DBG_OUTPUT_PORT.println(state.gas_resistance);
230241// DBG_OUTPUT_PORT.println(state.gas);
231242
@@ -305,9 +316,9 @@ int BME680Controller::getpsevdoIaqGasScore(int val) {
305316 // Calculate gas contribution to IAQ index
306317 const int maxiaq = 500 ;
307318 if (val > gas_upper_limit)
308- return maxiaq;
309- if (val < gas_lower_limit)
310319 return 0 ;
320+ if (val < gas_lower_limit)
321+ return maxiaq;
311322 int gas_score = maxiaq -( (val - gas_lower_limit) * maxiaq )/ (gas_upper_limit - gas_lower_limit);
312323
313324 return gas_score;
0 commit comments