Skip to content

Commit

Permalink
Fix Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
flamerten committed Dec 17, 2022
1 parent 5b6d9ea commit 5242f56
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions Adafruit_BME280.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,36 +447,36 @@ float Adafruit_BME280::readAltitude(float seaLevel) {
return 44330.0 * (1.0 - pow(atmospheric / seaLevel, 0.1903));
}

/*!
* Computes Heat Index based on https://byjus.com/heat-index-formula/
* @param isCelcius - if true return Heat Index in degrees celcius else return
* in Farenheit
*/
/*!
* Computes Heat Index based on https://byjus.com/heat-index-formula/
* @param isCelcius - if true return Heat Index in degrees celcius else return
* in Farenheit
*/
float Adafruit_BME280::readHeatIndex(bool isCelcius) {
float tempF = readTemperature() * 1.8 + 32;
float humidity = readHumidity();
float hi = 0.5 * (tempF + 61.0 + ((tempF - 68.0) * 1.2) + (humidity * 0.094));
float tempF = readTemperature() * 1.8 + 32;
float humidity = readHumidity();
float hi = 0.5 * (tempF + 61.0 + ((tempF - 68.0) * 1.2) + (humidity * 0.094));

if (hi > 79) {
hi = -42.379 + 2.04901523 * tempF + 10.14333127 * humidity +
-0.22475541 * tempF * humidity + -0.00683783 * pow(tempF, 2) +
-0.05481717 * pow(humidity, 2) +
0.00122874 * pow(tempF, 2) * humidity +
0.00085282 * tempF * pow(humidity, 2) +
-0.00000199 * pow(tempF, 2) * pow(humidity, 2);
if ((humidity < 13) && (tempF >= 80.0) && (tempF <= 112.0))
-0.22475541 * tempF * humidity + -0.00683783 * pow(tempF, 2) +
-0.05481717 * pow(humidity, 2) +
0.00122874 * pow(tempF, 2) * humidity +
0.00085282 * tempF * pow(humidity, 2) +
-0.00000199 * pow(tempF, 2) * pow(humidity, 2);

if ((humidity < 13) && (tempF >= 80.0) && (tempF <= 112.0))
hi -= ((13.0 - humidity) * 0.25) *
sqrt((17.0 - abs(tempF - 95.0)) * 0.05882);

else if ((humidity > 85.0) && (tempF >= 80.0) && (tempF <= 87.0))
else if ((humidity > 85.0) && (tempF >= 80.0) && (tempF <= 87.0))
hi += ((humidity - 85.0) * 0.1) * ((87.0 - tempF) * 0.2);
}
if (isCelcius)
return (hi - 32) * 0.5556; // convert back to celcius
else
return hi;
}

if (isCelcius)
return (hi - 32) * 0.5556; // convert back to celcius
else
return hi;
}

/*!
Expand Down

0 comments on commit 5242f56

Please sign in to comment.