Skip to content

Commit eadb75f

Browse files
committed
Add option for humidity compensation
1 parent f5d2ac2 commit eadb75f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/hackair.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,8 @@ void hackAIR::turnOff() {
178178
#endif
179179
}
180180
}
181+
182+
void humidityCompensation(hackAirData &data, float humidity) {
183+
data.pm25 = data.pm25 / (3.72f * (1 + 7 * (humidity / 100.0f)));
184+
data.pm10 = data.pm10 / (3.72f * (1 + 7 * (humidity / 100.0f)));
185+
}

src/hackair.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ class hackAIR {
9090
*/
9191
void turnOff();
9292

93+
/**
94+
* Compensates the measurements for the given humidity
95+
*/
96+
void humidityCompensation(hackAirData &data, float humidity);
97+
9398
private:
9499
int _sensorType;
95100
long _lastTime;

0 commit comments

Comments
 (0)