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

Support for setting ENVDATA using temperature in C and humidity as percent #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eried
Copy link

@eried eried commented Feb 6, 2019

src/ccs811.cpp Show resolved Hide resolved
Comment on lines +327 to +331
//Check for invalid temperatures
temperature = max(-25,min(temperature,50));

//Check for invalid humidity
relativeHumidity = max(0,min(relativeHumidity,100));
Copy link

Choose a reason for hiding this comment

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

Unfortunately, this was not compiling on my side. Maybe I had wired settings in the compiler. But changing that to the following code worked for me:

Suggested change
//Check for invalid temperatures
temperature = max(-25,min(temperature,50));
//Check for invalid humidity
relativeHumidity = max(0,min(relativeHumidity,100));
//Check for invalid temperatures
temperature = max(-25.0f,min(temperature,50.0f));
//Check for invalid humidity
relativeHumidity = max(0.0f,min(relativeHumidity,100.0f));

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.

None yet

3 participants