Merge pull request #6451 from gemu2015/sgp30-fix

fix sgp30
This commit is contained in:
Theo Arends 2019-09-18 19:35:02 +02:00 committed by GitHub
commit d9391dca01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 6 deletions

View File

@ -124,14 +124,11 @@ void Sgp30Show(bool json)
if (sgp30_ready) { if (sgp30_ready) {
char abs_hum[33]; char abs_hum[33];
if (global_update && global_humidity>0 && global_temperature!=9999) {
// has humidity + temperature
dtostrfd(sgp30_abshum,4,abs_hum);
}
if (json) { if (json) {
ResponseAppend_P(PSTR(",\"SGP30\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d"), sgp.eCO2, sgp.TVOC); ResponseAppend_P(PSTR(",\"SGP30\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d"), sgp.eCO2, sgp.TVOC);
if (global_update) { if (global_update) && global_humidity>0 && global_temperature!=9999) {
// has humidity + temperature
dtostrfd(sgp30_abshum,4,abs_hum);
ResponseAppend_P(PSTR(",\"" D_JSON_AHUM "\":%s"),abs_hum); ResponseAppend_P(PSTR(",\"" D_JSON_AHUM "\":%s"),abs_hum);
} }
ResponseJsonEnd(); ResponseJsonEnd();