Skip to content

Commit

Permalink
Improved range checking for Gas readings and then IAQ
Browse files Browse the repository at this point in the history
  • Loading branch information
G6EJD authored Dec 11, 2017
1 parent 33f235b commit 3331554
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ESP32_bme680_CC_demo_02.ino
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ void loop() {
//Calculate gas contribution to IAQ index
int gas_lower_limit = 50000; // Bad air quality limit
int gas_upper_limit = 500000; // Good air quality limit
  if (gas_reference > gas_upper_limit) gas_reference = gas_upper_limit; 
if (gas_reference < gas_lower_limit) gas_reference = gas_lower_limit;
gas_score = (0.75/(gas_upper_limit-gas_lower_limit)*gas_reference -(gas_lower_limit*(0.75/(gas_upper_limit-gas_lower_limit))))*100;

//Combine results for the final IAQ index value (0-100% where 100% is good quality air)
Expand Down Expand Up @@ -145,5 +147,3 @@ String CalculateIAQ(float score){
else if (score >= 00 && score <= 50 ) IAQ_text += "Good";
return IAQ_text;
}


0 comments on commit 3331554

Please sign in to comment.