mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-04 11:46:32 +02:00
Rename temperatureCompensated
to compensateTemp
and humidityCompensated
to compensateHum
This commit is contained in:
@ -1054,9 +1054,9 @@ static void updatePm(void) {
|
|||||||
Serial.printf("[1] Temperature in C: %0.2f\r\n", measurements.temp_1);
|
Serial.printf("[1] Temperature in C: %0.2f\r\n", measurements.temp_1);
|
||||||
Serial.printf("[1] Relative Humidity: %d\r\n", measurements.hum_1);
|
Serial.printf("[1] Relative Humidity: %d\r\n", measurements.hum_1);
|
||||||
Serial.printf("[1] Temperature compensated in C: %0.2f\r\n",
|
Serial.printf("[1] Temperature compensated in C: %0.2f\r\n",
|
||||||
ag->pms5003t_1.temperatureCompensated(measurements.temp_1));
|
ag->pms5003t_1.compensateTemp(measurements.temp_1));
|
||||||
Serial.printf("[1] Relative Humidity compensated: %0.2f\r\n",
|
Serial.printf("[1] Relative Humidity compensated: %0.2f\r\n",
|
||||||
ag->pms5003t_1.humidityCompensated(measurements.hum_1));
|
ag->pms5003t_1.compensateHum(measurements.hum_1));
|
||||||
|
|
||||||
ag->pms5003t_1.resetFailCount();
|
ag->pms5003t_1.resetFailCount();
|
||||||
} else {
|
} else {
|
||||||
@ -1097,9 +1097,9 @@ static void updatePm(void) {
|
|||||||
Serial.printf("[2] Temperature in C: %0.2f\r\n", measurements.temp_2);
|
Serial.printf("[2] Temperature in C: %0.2f\r\n", measurements.temp_2);
|
||||||
Serial.printf("[2] Relative Humidity: %d\r\n", measurements.hum_2);
|
Serial.printf("[2] Relative Humidity: %d\r\n", measurements.hum_2);
|
||||||
Serial.printf("[2] Temperature compensated in C: %0.2f\r\n",
|
Serial.printf("[2] Temperature compensated in C: %0.2f\r\n",
|
||||||
ag->pms5003t_1.temperatureCompensated(measurements.temp_2));
|
ag->pms5003t_1.compensateTemp(measurements.temp_2));
|
||||||
Serial.printf("[2] Relative Humidity compensated: %0.2f\r\n",
|
Serial.printf("[2] Relative Humidity compensated: %0.2f\r\n",
|
||||||
ag->pms5003t_1.humidityCompensated(measurements.hum_2));
|
ag->pms5003t_1.compensateHum(measurements.hum_2));
|
||||||
|
|
||||||
ag->pms5003t_2.resetFailCount();
|
ag->pms5003t_2.resetFailCount();
|
||||||
} else {
|
} else {
|
||||||
|
@ -118,8 +118,8 @@ String OpenMetrics::getPayload(void) {
|
|||||||
atmpCompensated = _temp;
|
atmpCompensated = _temp;
|
||||||
ahumCompensated = _hum;
|
ahumCompensated = _hum;
|
||||||
} else {
|
} else {
|
||||||
atmpCompensated = ag->pms5003t_1.temperatureCompensated(_temp);
|
atmpCompensated = ag->pms5003t_1.compensateTemp(_temp);
|
||||||
ahumCompensated = ag->pms5003t_1.humidityCompensated(_hum);
|
ahumCompensated = ag->pms5003t_1.compensateHum(_hum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.hasSensorPMS1 || config.hasSensorPMS2) {
|
if (config.hasSensorPMS1 || config.hasSensorPMS2) {
|
||||||
|
@ -76,7 +76,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
if (utils::isValidTemperature(this->temp_1) && utils::isValidTemperature(this->temp_1)) {
|
if (utils::isValidTemperature(this->temp_1) && utils::isValidTemperature(this->temp_1)) {
|
||||||
root["atmp"] = ag->round2((this->temp_1 + this->temp_2) / 2.0f);
|
root["atmp"] = ag->round2((this->temp_1 + this->temp_2) / 2.0f);
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_2.temperatureCompensated((this->temp_1 + this->temp_2) / 2.0f);
|
val = ag->pms5003t_2.compensateTemp((this->temp_1 + this->temp_2) / 2.0f);
|
||||||
if (utils::isValidTemperature(val)) {
|
if (utils::isValidTemperature(val)) {
|
||||||
root["atmpCompensated"] = ag->round2(val);
|
root["atmpCompensated"] = ag->round2(val);
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
if (utils::isValidHumidity(this->hum_1) && utils::isValidHumidity(this->hum_1)) {
|
if (utils::isValidHumidity(this->hum_1) && utils::isValidHumidity(this->hum_1)) {
|
||||||
root["rhum"] = ag->round2((this->hum_1 + this->hum_2) / 2.0f);
|
root["rhum"] = ag->round2((this->hum_1 + this->hum_2) / 2.0f);
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_2.humidityCompensated((this->hum_1 + this->hum_2) / 2.0f);
|
val = ag->pms5003t_2.compensateHum((this->hum_1 + this->hum_2) / 2.0f);
|
||||||
if (utils::isValidHumidity(val)) {
|
if (utils::isValidHumidity(val)) {
|
||||||
root["rhumCompensated"] = (int)val;
|
root["rhumCompensated"] = (int)val;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["atmp"] = ag->round2(this->temp_1);
|
root["atmp"] = ag->round2(this->temp_1);
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_1.temperatureCompensated(this->temp_1);
|
val = ag->pms5003t_1.compensateTemp(this->temp_1);
|
||||||
if (utils::isValidTemperature(val)) {
|
if (utils::isValidTemperature(val)) {
|
||||||
root["atmpCompensated"] = ag->round2(val);
|
root["atmpCompensated"] = ag->round2(val);
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["rhum"] = this->hum_1;
|
root["rhum"] = this->hum_1;
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_1.humidityCompensated(this->hum_1);
|
val = ag->pms5003t_1.compensateHum(this->hum_1);
|
||||||
if (utils::isValidHumidity(val)) {
|
if (utils::isValidHumidity(val)) {
|
||||||
root["rhumCompensated"] = (int)val;
|
root["rhumCompensated"] = (int)val;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["atmp"] = ag->round2(this->temp_2);
|
root["atmp"] = ag->round2(this->temp_2);
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_2.temperatureCompensated(this->temp_2);
|
val = ag->pms5003t_2.compensateTemp(this->temp_2);
|
||||||
if (utils::isValidTemperature(val)) {
|
if (utils::isValidTemperature(val)) {
|
||||||
root["atmpCompensated"] = ag->round2(val);
|
root["atmpCompensated"] = ag->round2(val);
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["rhum"] = this->hum_2;
|
root["rhum"] = this->hum_2;
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_2.humidityCompensated(this->hum_2);
|
val = ag->pms5003t_2.compensateHum(this->hum_2);
|
||||||
if (utils::isValidHumidity(val)) {
|
if (utils::isValidHumidity(val)) {
|
||||||
root["rhumCompensated"] = (int)val;
|
root["rhumCompensated"] = (int)val;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["atmp"] = ag->round2(this->temp_1);
|
root["atmp"] = ag->round2(this->temp_1);
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_1.temperatureCompensated(this->temp_1);
|
val = ag->pms5003t_1.compensateTemp(this->temp_1);
|
||||||
if (utils::isValidTemperature(val)) {
|
if (utils::isValidTemperature(val)) {
|
||||||
root["atmpCompensated"] = ag->round2(val);
|
root["atmpCompensated"] = ag->round2(val);
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
if (utils::isValidHumidity(this->hum_1)) {
|
if (utils::isValidHumidity(this->hum_1)) {
|
||||||
root["rhum"] = this->hum_1;
|
root["rhum"] = this->hum_1;
|
||||||
if(localServer) {
|
if(localServer) {
|
||||||
val = ag->pms5003t_1.humidityCompensated(this->hum_1);
|
val = ag->pms5003t_1.compensateHum(this->hum_1);
|
||||||
if(utils::isValidHumidity(val)) {
|
if(utils::isValidHumidity(val)) {
|
||||||
root["rhumCompensated"] = (int)val;
|
root["rhumCompensated"] = (int)val;
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["atmp"] = ag->round2(this->temp_2);
|
root["atmp"] = ag->round2(this->temp_2);
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
|
|
||||||
val = ag->pms5003t_1.temperatureCompensated(this->temp_2);
|
val = ag->pms5003t_1.compensateTemp(this->temp_2);
|
||||||
if (utils::isValidTemperature(val)) {
|
if (utils::isValidTemperature(val)) {
|
||||||
root["atmpCompensated"] = ag->round2(val);
|
root["atmpCompensated"] = ag->round2(val);
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["rhum"] = this->hum_2;
|
root["rhum"] = this->hum_2;
|
||||||
|
|
||||||
if(localServer) {
|
if(localServer) {
|
||||||
val = ag->pms5003t_1.humidityCompensated(this->hum_2);
|
val = ag->pms5003t_1.compensateHum(this->hum_2);
|
||||||
if(utils::isValidHumidity(val)) {
|
if(utils::isValidHumidity(val)) {
|
||||||
root["rhumCompensated"] = (int)val;
|
root["rhumCompensated"] = (int)val;
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["channels"]["1"]["atmp"] = ag->round2(this->temp_1);
|
root["channels"]["1"]["atmp"] = ag->round2(this->temp_1);
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_1.temperatureCompensated(this->temp_1);
|
val = ag->pms5003t_1.compensateTemp(this->temp_1);
|
||||||
if (utils::isValidTemperature(val)) {
|
if (utils::isValidTemperature(val)) {
|
||||||
root["channels"]["1"]["atmpCompensated"] = ag->round2(val);
|
root["channels"]["1"]["atmpCompensated"] = ag->round2(val);
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["channels"]["1"]["rhum"] = this->hum_1;
|
root["channels"]["1"]["rhum"] = this->hum_1;
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_1.humidityCompensated(this->hum_1);
|
val = ag->pms5003t_1.compensateHum(this->hum_1);
|
||||||
if (utils::isValidHumidity(val)) {
|
if (utils::isValidHumidity(val)) {
|
||||||
root["channels"]["1"]["rhumCompensated"] = (int)val;
|
root["channels"]["1"]["rhumCompensated"] = (int)val;
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["channels"]["2"]["atmp"] = ag->round2(this->temp_2);
|
root["channels"]["2"]["atmp"] = ag->round2(this->temp_2);
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_1.temperatureCompensated(this->temp_2);
|
val = ag->pms5003t_1.compensateTemp(this->temp_2);
|
||||||
if (utils::isValidTemperature(val)) {
|
if (utils::isValidTemperature(val)) {
|
||||||
root["channels"]["2"]["atmpCompensated"] = ag->round2(val);
|
root["channels"]["2"]["atmpCompensated"] = ag->round2(val);
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
|||||||
root["channels"]["2"]["rhum"] = this->hum_2;
|
root["channels"]["2"]["rhum"] = this->hum_2;
|
||||||
|
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
val = ag->pms5003t_1.humidityCompensated(this->hum_2);
|
val = ag->pms5003t_1.compensateHum(this->hum_2);
|
||||||
if (utils::isValidHumidity(val)) {
|
if (utils::isValidHumidity(val)) {
|
||||||
root["channels"]["2"]["rhumCompensated"] = (int)val;
|
root["channels"]["2"]["rhumCompensated"] = (int)val;
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@ PMS5003TBase::PMS5003TBase() {}
|
|||||||
|
|
||||||
PMS5003TBase::~PMS5003TBase() {}
|
PMS5003TBase::~PMS5003TBase() {}
|
||||||
|
|
||||||
float PMS5003TBase::temperatureCompensated(float temp) {
|
float PMS5003TBase::compensateTemp(float temp) {
|
||||||
if (temp < 10.0f) {
|
if (temp < 10.0f) {
|
||||||
return temp * 1.327f - 6.738f;
|
return temp * 1.327f - 6.738f;
|
||||||
}
|
}
|
||||||
return temp * 1.181f - 5.113f;
|
return temp * 1.181f - 5.113f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float PMS5003TBase::humidityCompensated(float hum) {
|
float PMS5003TBase::compensateHum(float hum) {
|
||||||
hum = hum * 1.259f + 7.34f;
|
hum = hum * 1.259f + 7.34f;
|
||||||
|
|
||||||
if (hum > 100.0f) {
|
if (hum > 100.0f) {
|
||||||
|
@ -8,8 +8,8 @@ private:
|
|||||||
public:
|
public:
|
||||||
PMS5003TBase();
|
PMS5003TBase();
|
||||||
~PMS5003TBase();
|
~PMS5003TBase();
|
||||||
float temperatureCompensated(float temp);
|
float compensateTemp(float temp);
|
||||||
float humidityCompensated(float hum);
|
float compensateHum(float hum);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user