add compensation temperature and humidity for SGP41

This commit is contained in:
Phat Nguyen
2024-03-10 11:20:52 +07:00
parent b94ae9eff0
commit 6837529096
4 changed files with 41 additions and 3 deletions

View File

@ -1204,6 +1204,25 @@ static void pmUpdate(void) {
pm2hum = 0;
}
}
if (hasSensorSGP) {
float temp;
float hum;
if (pmsResult_1 && pmsResult_2) {
temp = (temp_1 + temp_2) / 2.0f;
hum = (hum_1 + hum_2) / 2.0f;
} else {
if (pmsResult_1) {
temp = temp_1;
hum = hum_1;
}
if (pmsResult_2) {
temp = temp_2;
hum = hum_2;
}
}
ag.sgp41.setCompensationTemperatureHumidity(temp, hum);
}
}
static void co2Update(void) {