diff --git a/DHT.cpp b/DHT.cpp index 9181432..da7a6ad 100644 --- a/DHT.cpp +++ b/DHT.cpp @@ -19,7 +19,7 @@ DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) { _maxcycles = microsecondsToClockCycles(1000); // 1 millisecond timeout for // reading pulses from DHT sensor. // Note that count is now ignored as the DHT reading algorithm adjusts itself - // basd on the speed of the processor. + // based on the speed of the processor. } void DHT::begin(void) { @@ -92,7 +92,13 @@ float DHT::readHumidity(bool force) { } //boolean isFahrenheit: True == Fahrenheit; False == Celcius -float DHT::computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit) { +float DHT::computeHeatIndex(isFahrenheit) { + float hi = self.computeHeatIndex(self.readTemperature(isFahrenheit), self.readHumidity(), isFahrenheit); + return isFahrenheit ? hi : convertFtoC(hi); +} + +//boolean isFahrenheit: True == Fahrenheit; False == Celcius +float DHT::computeHeatIndex(float temperature, floast percentHumidity, bool isFahrenheit) { // Using both Rothfusz and Steadman's equations // http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml float hi; diff --git a/DHT.h b/DHT.h index 2a5ccc2..7ab65a7 100644 --- a/DHT.h +++ b/DHT.h @@ -43,6 +43,7 @@ class DHT { float readTemperature(bool S=false, bool force=false); float convertCtoF(float); float convertFtoC(float); + float computeHeatIndex(bool isFahrenheit=true); float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=true); float readHumidity(bool force=false); bool read(bool force=false);