Skip to content

Conversation

pnt325
Copy link
Contributor

@pnt325 pnt325 commented Jul 10, 2024

Correct sensor value has out of range #190

}

int utils::correctPMS(int value) {
if (value < 10) {
Copy link

Choose a reason for hiding this comment

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

Why not allow values below 10? My sensors regularly go below that. Maybe limit it to 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Byter09 Please check the issue #190 and add your comments at there.

Copy link

Choose a reason for hiding this comment

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

I mean I don't have to. Even that issue says 0 should be the lowest value for PM data.

Copy link
Owner

@airgradienthq airgradienthq left a comment

Choose a reason for hiding this comment

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

A few things:
Only negative PM values (below 0) need to be ignored. 0..10 are valid readings and should be allowed.

Also, if a value is outside the range, the value should be completely ignored.

So for example Temperature -100 should NOT return -40 but be ignored. This would apply to all checks.

@pnt325
Copy link
Contributor Author

pnt325 commented Jul 22, 2024

A few things: Only negative PM values (below 0) need to be ignored. 0..10 are valid readings and should be allowed.

Also, if a value is outside the range, the value should be completely ignored.

So for example Temperature -100 should NOT return -40 but be ignored. This would apply to all checks.

For this way we don't need to correct value in range, just need to verify it's valid or not before use(show on display or sync to cloud).

The correction method will be remove and replace check valid valid method.

bool utils::validTemperature(float value) {
  if (value >= VALID_TEMPERATURE_MIN && value <= VALID_TEMPERATURE_MAX) {
    return true;
  }
  return false;
}

@airgradienthq How do you think?

@airgradienthq
Copy link
Owner

@pnt325 yes I think that's how it should work.

@pnt325 pnt325 requested review from airgradienthq and Byter09 July 24, 2024 02:06
Copy link

@Byter09 Byter09 left a comment

Choose a reason for hiding this comment

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

I know I was asked to review this, but I don't know internals. So from a basic look at it, it looks good to me. 😛

@airgradienthq airgradienthq merged commit 6a0d88f into develop Jul 25, 2024
@pnt325 pnt325 deleted the hotfix/ignore-parameter-out-of-range branch July 25, 2024 23:20
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