Skip to content

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

Open
eried wants to merge 2 commits into
maarten-pennings:masterfrom
eried:master
Open

Support for setting ENVDATA using temperature in C and humidity as percent#13
eried wants to merge 2 commits into
maarten-pennings:masterfrom
eried:master

Conversation

@eried

@eried eried commented Feb 6, 2019

Copy link
Copy Markdown

Comment thread src/ccs811.cpp
Comment thread src/ccs811.cpp
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
Copy Markdown

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.

3 participants