Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix print log message number format #223

Merged
merged 6 commits into from
Sep 2, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/OneOpenAir/OneOpenAir.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ static void updatePm(void) {
Serial.printf("[1] Relative Humidity: %d\r\n", measurements.hum_1);
Serial.printf("[1] Temperature compensated in C: %0.2f\r\n",
ag->pms5003t_1.temperatureCompensated(measurements.temp_1));
Serial.printf("[1] Relative Humidity compensated: %f\r\n",
Serial.printf("[1] Relative Humidity compensated: %0.2f\r\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The methods below should be renamed to compensateTemp / compensateHum and also documented. I mean we need to explain what the formula is, maybe link to some external document

float PMS5003TBase::temperatureCompensated(float temp) {
if (temp < 10.0f) {
return temp * 1.327f - 6.738f;
}
return temp * 1.181f - 5.113f;
}

float PMS5003TBase::humidityCompensated(float hum) {
hum = hum * 1.259f + 7.34f;

if (hum > 100.0f) {
hum = 100.0f;
}
return hum;
}

float PMS5003TBase::temperatureCompensated(float temp) {
if (temp < 10.0f) {
return temp * 1.327f - 6.738f;
}
return temp * 1.181f - 5.113f;
}

float PMS5003TBase::humidityCompensated(float hum) {
hum = hum * 1.259f + 7.34f;

if (hum > 100.0f) {
hum = 100.0f;
}
return hum;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The methods below should be renamed to compensateTemp / compensateHum and also documented. I mean we need to explain what the formula is, maybe link to some external document

@nick-4711 OK

@airgradienthq Can you provide the link document for the formula.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ag->pms5003t_1.humidityCompensated(measurements.hum_1));
} else {
measurements.pm01_1 = utils::getInvalidPMS();
Expand Down Expand Up @@ -1081,7 +1081,7 @@ static void updatePm(void) {
Serial.printf("[2] Relative Humidity: %d\r\n", measurements.hum_2);
Serial.printf("[2] Temperature compensated in C: %0.2f\r\n",
ag->pms5003t_1.temperatureCompensated(measurements.temp_2));
Serial.printf("[2] Relative Humidity compensated: %d\r\n",
Serial.printf("[2] Relative Humidity compensated: %0.2f\r\n",
ag->pms5003t_1.humidityCompensated(measurements.hum_2));
} else {
measurements.pm01_2 = utils::getInvalidPMS();
Expand Down