2024-04-22 16:30:57 +07:00
|
|
|
#include "PMS5003TBase.h"
|
|
|
|
|
|
|
|
PMS5003TBase::PMS5003TBase() {}
|
|
|
|
|
|
|
|
PMS5003TBase::~PMS5003TBase() {}
|
|
|
|
|
2024-08-30 19:20:08 +07:00
|
|
|
/**
|
|
|
|
* @brief Compensate the temperature
|
|
|
|
*
|
|
|
|
* Reference formula: https://www.airgradient.com/documentation/correction-algorithms/
|
|
|
|
*
|
|
|
|
* @param temp
|
|
|
|
* @return * float
|
|
|
|
*/
|
2024-08-30 19:17:58 +07:00
|
|
|
float PMS5003TBase::compensateTemp(float temp) {
|
2024-04-22 16:30:57 +07:00
|
|
|
if (temp < 10.0f) {
|
|
|
|
return temp * 1.327f - 6.738f;
|
|
|
|
}
|
|
|
|
return temp * 1.181f - 5.113f;
|
|
|
|
}
|
|
|
|
|
2024-08-30 19:20:08 +07:00
|
|
|
/**
|
|
|
|
* @brief Compensate the humidity
|
|
|
|
*
|
|
|
|
* Reference formula: https://www.airgradient.com/documentation/correction-algorithms/
|
|
|
|
*
|
|
|
|
* @param temp
|
|
|
|
* @return * float
|
|
|
|
*/
|
2024-08-30 19:17:58 +07:00
|
|
|
float PMS5003TBase::compensateHum(float hum) {
|
2024-04-22 16:30:57 +07:00
|
|
|
hum = hum * 1.259f + 7.34f;
|
|
|
|
|
|
|
|
if (hum > 100.0f) {
|
|
|
|
hum = 100.0f;
|
|
|
|
}
|
|
|
|
return hum;
|
|
|
|
}
|