@@ -31,6 +31,7 @@ float compTemperature = 0;
3131float rawHumidity = 0 ;
3232float compHumidity = 0 ;
3333float readIAQ = 0 ;
34+ float readStaticIAQ = 0 ;
3435float readCO2 = 0 ;
3536#endif
3637
@@ -171,20 +172,20 @@ void checkBMEStatus(Bsec2 bsec)
171172{
172173 if (bsec.status < BSEC_OK)
173174 {
174- MESH_DEBUG_PRINTLN (" BSEC error code : %f" , String (bsec.status ));
175+ MESH_DEBUG_PRINTLN (" BSEC error code : %f" , float (bsec.status ));
175176 }
176177 else if (bsec.status > BSEC_OK)
177178 {
178- MESH_DEBUG_PRINTLN (" BSEC warning code : %f" , String (bsec.status ));
179+ MESH_DEBUG_PRINTLN (" BSEC warning code : %f" , float (bsec.status ));
179180 }
180181
181182 if (bsec.sensor .status < BME68X_OK)
182183 {
183- MESH_DEBUG_PRINTLN (" BME68X error code : %f" , String ( bsec.sensor .status ) );
184+ MESH_DEBUG_PRINTLN (" BME68X error code : %f" , bsec.sensor .status );
184185 }
185186 else if (bsec.sensor .status > BME68X_OK)
186187 {
187- MESH_DEBUG_PRINTLN (" BME68X warning code : %f" , String ( bsec.sensor .status ) );
188+ MESH_DEBUG_PRINTLN (" BME68X warning code : %f" , bsec.sensor .status );
188189 }
189190}
190191void newDataCallback (const bme68xData data, const bsecOutputs outputs, Bsec2 bsec)
@@ -195,61 +196,62 @@ void newDataCallback(const bme68xData data, const bsecOutputs outputs, Bsec2 bse
195196 return ;
196197 }
197198
198- MESH_DEBUG_PRINTLN (" BSEC outputs:\n\t Time stamp = %f" , String (( int ) (outputs.output [0 ].time_stamp / INT64_C (1000000 ) )));
199+ MESH_DEBUG_PRINTLN (" BSEC outputs:\n\t Time stamp = %f" , ( int ) (outputs.output [0 ].time_stamp / INT64_C (1000000 )));
199200 for (uint8_t i = 0 ; i < outputs.nOutputs ; i++)
200201 {
201202 const bsecData output = outputs.output [i];
202203 switch (output.sensor_id )
203204 {
204205 case BSEC_OUTPUT_IAQ:
205- MESH_DEBUG_PRINTLN (" \t IAQ = %f" , String (output.signal ));
206- MESH_DEBUG_PRINTLN (" \t IAQ accuracy = %f" , String ((int ) output.accuracy ));
206+ readIAQ = output.signal ;
207+ MESH_DEBUG_PRINTLN (" \t IAQ = %f" , output.signal );
208+ MESH_DEBUG_PRINTLN (" \t IAQ accuracy = %f" , output.accuracy );
207209 break ;
208210 case BSEC_OUTPUT_RAW_TEMPERATURE:
209211 rawTemperature = output.signal ;
210- MESH_DEBUG_PRINTLN (" \t Temperature = %f" , String ( output.signal ) );
212+ MESH_DEBUG_PRINTLN (" \t Temperature = %f" , output.signal );
211213 break ;
212214 case BSEC_OUTPUT_RAW_PRESSURE:
213215 rawPressure = output.signal ;
214- MESH_DEBUG_PRINTLN (" \t Pressure = %f" , String ( output.signal ) );
216+ MESH_DEBUG_PRINTLN (" \t Pressure = %f" , output.signal );
215217 break ;
216218 case BSEC_OUTPUT_RAW_HUMIDITY:
217219 rawHumidity = output.signal ;
218- MESH_DEBUG_PRINTLN (" \t Humidity = %f" , String ( output.signal ) );
220+ MESH_DEBUG_PRINTLN (" \t Humidity = %f" , output.signal );
219221 break ;
220222 case BSEC_OUTPUT_RAW_GAS:
221- MESH_DEBUG_PRINTLN (" \t Gas resistance = %f" , String ( output.signal ) );
223+ MESH_DEBUG_PRINTLN (" \t Gas resistance = %f" , output.signal );
222224 break ;
223225 case BSEC_OUTPUT_STABILIZATION_STATUS:
224- MESH_DEBUG_PRINTLN (" \t Stabilization status = %f" , String ( output.signal ) );
226+ MESH_DEBUG_PRINTLN (" \t Stabilization status = %f" , output.signal );
225227 break ;
226228 case BSEC_OUTPUT_RUN_IN_STATUS:
227- MESH_DEBUG_PRINTLN (" \t Run in status = %f" , String ( output.signal ) );
229+ MESH_DEBUG_PRINTLN (" \t Run in status = %f" , output.signal );
228230 break ;
229231 case BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE:
230232 compTemperature = output.signal ;
231- MESH_DEBUG_PRINTLN (" \t Compensated temperature = %f" , String ( output.signal ) );
233+ MESH_DEBUG_PRINTLN (" \t Compensated temperature = %f" , output.signal );
232234 break ;
233235 case BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY:
234236 compHumidity = output.signal ;
235- MESH_DEBUG_PRINTLN (" \t Compensated humidity = %f" , String ( output.signal ) );
237+ MESH_DEBUG_PRINTLN (" \t Compensated humidity = %f" , output.signal );
236238 break ;
237239 case BSEC_OUTPUT_STATIC_IAQ:
238- readIAQ = output.signal ;
239- MESH_DEBUG_PRINTLN (" \t Static IAQ = %f" , String ( output.signal ) );
240+ readStaticIAQ = output.signal ;
241+ MESH_DEBUG_PRINTLN (" \t Static IAQ = %f" , output.signal );
240242 break ;
241243 case BSEC_OUTPUT_CO2_EQUIVALENT:
242244 readCO2 = output.signal ;
243- MESH_DEBUG_PRINTLN (" \t CO2 Equivalent = %f" , String ( output.signal ) );
245+ MESH_DEBUG_PRINTLN (" \t CO2 Equivalent = %f" , output.signal );
244246 break ;
245247 case BSEC_OUTPUT_BREATH_VOC_EQUIVALENT:
246- MESH_DEBUG_PRINTLN (" \t bVOC equivalent = %f" , String ( output.signal ) );
248+ MESH_DEBUG_PRINTLN (" \t bVOC equivalent = %f" , output.signal );
247249 break ;
248250 case BSEC_OUTPUT_GAS_PERCENTAGE:
249- MESH_DEBUG_PRINTLN (" \t Gas percentage = %f" , String ( output.signal ) );
251+ MESH_DEBUG_PRINTLN (" \t Gas percentage = %f" , output.signal );
250252 break ;
251253 case BSEC_OUTPUT_COMPENSATED_GAS:
252- MESH_DEBUG_PRINTLN (" \t Compensated gas = %f" , String ( output.signal ) );
254+ MESH_DEBUG_PRINTLN (" \t Compensated gas = %f" , output.signal );
253255 break ;
254256 default :
255257 break ;
@@ -290,7 +292,7 @@ bool RAK4631SensorManager::begin() {
290292
291293 #if ENV_INCLUDE_BME680
292294
293- bsecSensor sensorList[4 ] = {
295+ bsecSensor sensorList[5 ] = {
294296 BSEC_OUTPUT_IAQ,
295297 // BSEC_OUTPUT_RAW_TEMPERATURE,
296298 BSEC_OUTPUT_RAW_PRESSURE,
@@ -300,7 +302,7 @@ bool RAK4631SensorManager::begin() {
300302 // BSEC_OUTPUT_RUN_IN_STATUS,
301303 BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE,
302304 BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY,
303- // BSEC_OUTPUT_STATIC_IAQ,
305+ BSEC_OUTPUT_STATIC_IAQ,
304306 // BSEC_OUTPUT_CO2_EQUIVALENT,
305307 // BSEC_OUTPUT_BREATH_VOC_EQUIVALENT,
306308 // BSEC_OUTPUT_GAS_PERCENTAGE,
@@ -351,7 +353,8 @@ bool RAK4631SensorManager::querySensors(uint8_t requester_permissions, CayenneLP
351353 telemetry.addTemperature (TELEM_CHANNEL_SELF, compTemperature);
352354 telemetry.addRelativeHumidity (TELEM_CHANNEL_SELF, compHumidity);
353355 telemetry.addBarometricPressure (TELEM_CHANNEL_SELF, rawPressure);
354- telemetry.addRelativeHumidity (TELEM_CHANNEL_SELF+1 , readIAQ);
356+ telemetry.addTemperature (TELEM_CHANNEL_SELF+1 , readIAQ);
357+ telemetry.addRelativeHumidity (TELEM_CHANNEL_SELF+1 , readStaticIAQ);
355358 }
356359 #endif
357360 }
0 commit comments