Skip to content

Conversation

pnt325
Copy link
Contributor

@pnt325 pnt325 commented Aug 15, 2024

Update the PM2.5 calculate formula #182 . The correct value show on device display or use on local only.

@@ -304,6 +304,10 @@ void OledDisplay::showDashboard(const char *status) {
DISP()->drawStr(55, 27, "PM2.5");

/** Draw PM2.5 value */
int pm25 = value.pm25_1;
if (config.hasSensorSHT) {
pm25 = ag->pms5003.pm25Compensated(pm25, value.Humidity);
Copy link
Collaborator

Choose a reason for hiding this comment

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

propose to rename the method to simply .compensate(). We can see from the params that this is related to pm25.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll change the name and update API comment to mention the input is PM2.5

src/PMS/PMS.cpp Outdated
*
* @param pm25 Raw PM2.5 value
* @param humidity Humidity value (%)
* @return float
Copy link
Collaborator

Choose a reason for hiding this comment

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

it returns an int? Propose to write

@return the compensated PM2.5 value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's return the int. I'll update the method comment

* @return float
*/
int PMSBase::pm25Compensated(int pm25, float humidity) {
float value;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to link to the documentation where this is from

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@airgradienthq please add your document for this formula.

@pnt325 pnt325 requested a review from nick-4711 August 15, 2024 23:40
@airgradienthq airgradienthq merged commit 219ff73 into develop Aug 18, 2024
20 checks passed
@pnt325 pnt325 deleted the feature/correct-pm2.5-formula branch August 19, 2024 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants