@@ -62,27 +62,27 @@ struct SEN6XDATA_s {
6262/* *******************************************************************************************/
6363
6464float Sen6xUInt16 (uint16_t value) {
65- return (value == SEN6X_UINT_INVALID) ? NAN : value;
65+ return (value == SEN6X_UINT_INVALID) ? NAN : value;
6666}
6767
6868float Sen6xUInt16Div10 (uint16_t value) {
69- return (value == SEN6X_UINT_INVALID) ? NAN : value / 10 .0f ;
69+ return (value == SEN6X_UINT_INVALID) ? NAN : value / 10 .0f ;
7070}
7171
7272float Sen6xInt16Div10 (int16_t value) {
73- return (value == SEN6X_INT_INVALID) ? NAN : value / 10 .0f ;
73+ return (value == SEN6X_INT_INVALID) ? NAN : value / 10 .0f ;
7474}
7575
7676float Sen6xTemperature (int16_t temperatureRaw) {
77- float temperature = 0.0 ;
78- temperature = temperatureRaw / 200.0 ;
79- return temperature;
77+ float temperature = 0.0 ;
78+ temperature = temperatureRaw / 200.0 ;
79+ return temperature;
8080}
8181
8282float Sen6xHumidity (int16_t humidityRaw) {
83- float humidity = 0.0 ;
84- humidity = humidityRaw / 100.0 ;
85- return humidity;
83+ float humidity = 0.0 ;
84+ humidity = humidityRaw / 100.0 ;
85+ return humidity;
8686}
8787
8888/* *******************************************************************************************/
@@ -447,16 +447,9 @@ void Sen6xShow(bool json) {
447447 float ambientTemperature = Sen6xTemperature (SEN6XDATA->temperature );
448448 float vocIndex = Sen6xInt16Div10 (SEN6XDATA->vocIndex );
449449 float noxIndex = Sen6xInt16Div10 (SEN6XDATA->noxIndex );
450-
451- float temperature = 0 ;
452- float humidity = 0 ;
453- float abs_humidity = 0 ;
454- bool ahum_available = (!isnan (ambientTemperature) && !isnan (ambientHumidity) && (ambientHumidity > 0 ));
455- if (ahum_available) {
456- temperature = ConvertTemp (ambientTemperature);
457- humidity = ConvertHumidity (ambientHumidity);
458- abs_humidity = CalcTempHumToAbsHum (ambientTemperature, ambientHumidity);
459- }
450+ float temperature = ConvertTemp (ambientTemperature);
451+ float humidity = ConvertHumidity (ambientHumidity);
452+ float abs_humidity = CalcTempHumToAbsHum (ambientTemperature, ambientHumidity);
460453
461454#ifdef USE_LIGHT
462455 LightSetSignal (CO2_LOW, CO2_HIGH, co2); // SetOption18 - Pair light signal with CO2 sensor
@@ -475,12 +468,9 @@ void Sen6xShow(bool json) {
475468 if (SEN6XDATA->features & SEN6X_VOCNOX) {
476469 ResponseAppend_P (PSTR (" ,\" NOx\" :%0_f,\" VOC\" :%0_f" ), &noxIndex, &vocIndex);
477470 }
478- if (ahum_available) {
479- ResponseAppend_P (PSTR (" ," ));
480- ResponseAppendTHD (temperature, humidity);
481- ResponseAppend_P (PSTR (" ,\" " D_JSON_AHUM " \" :%4_f" ), &abs_humidity);
482- }
483- ResponseJsonEnd ();
471+ ResponseAppend_P (PSTR (" ," ));
472+ ResponseAppendTHD (temperature, humidity);
473+ ResponseAppend_P (PSTR (" ,\" " D_JSON_AHUM " \" :%4_f}" ), &abs_humidity);
484474#ifdef USE_WEBSERVER
485475 } else {
486476 WSContentSend_PD (HTTP_SNS_F_ENVIRONMENTAL_CONCENTRATION, SEN6XDATA->name , " 1" , &massConcentrationPm1p0);
@@ -497,10 +487,8 @@ void Sen6xShow(bool json) {
497487 WSContentSend_PD (HTTP_SNS_F_NOX, SEN6XDATA->name , &noxIndex);
498488 WSContentSend_PD (HTTP_SNS_F_VOC, SEN6XDATA->name , &vocIndex);
499489 }
500- if (ahum_available) {
501- WSContentSend_THD (SEN6XDATA->name , temperature, humidity);
502- WSContentSend_PD (HTTP_SNS_F_ABS_HUM, SEN6XDATA->name , 4 , &abs_humidity);
503- }
490+ WSContentSend_THD (SEN6XDATA->name , temperature, humidity);
491+ WSContentSend_PD (HTTP_SNS_F_ABS_HUM, SEN6XDATA->name , 4 , &abs_humidity);
504492#endif
505493 }
506494}
0 commit comments