float Weather_HeatIndexDegC(void) { int8_t temperature = (int8_t) BME280_getTemperature(); //Current room temperature in Degrees Celsius int8_t humidity = (int8_t) BME280_getHumidity(); // Humidity in %RH float heatindex = 0; float hi[9] = {-8.784695,1.61139411,2.338549,-0.14611605,-1.2308094/100,-1.6424828/100,2.211732/1000,7.2546/10000,-3.582/1000000}; if ((humidity >= 40) && (temperature >= 27)) { heatindex = hi[0]; heatindex += hi[1] * temperature; heatindex += hi[2] * humidity; heatindex += hi[3] * temperature * humidity; heatindex += hi[4] * temperature * temperature; heatindex += hi[5] * humidity * humidity; heatindex += hi[6] * temperature * temperature * humidity; heatindex += hi[7] * temperature * humidity * humidity; heatindex += hi[8] * temperature * temperature * humidity * humidity; return (int8_t) heatindex; } else { return temperature; } }