mirror of https://github.com/arendst/Tasmota.git
Provide function FastPrecisePowf
Provide function FastPrecisePowf
This commit is contained in:
parent
be7ea38204
commit
5515a97be6
|
@ -674,6 +674,12 @@ double FastPrecisePow(double a, double b)
|
|||
return r * u.d;
|
||||
}
|
||||
|
||||
float FastPrecisePowf(const float x, const float y)
|
||||
{
|
||||
// return (float)(pow((double)x, (double)y));
|
||||
return (float)FastPrecisePow(x, y);
|
||||
}
|
||||
|
||||
uint32_t SqrtInt(uint32_t num)
|
||||
{
|
||||
if (num <= 1) {
|
||||
|
|
|
@ -718,10 +718,6 @@ void LightStateClass::HsToRgb(uint16_t hue, uint8_t sat, uint8_t *r_r, uint8_t *
|
|||
|
||||
#define POW FastPrecisePowf
|
||||
|
||||
float FastPrecisePowf(float a, float b) {
|
||||
return (float) FastPrecisePow(a,b);
|
||||
}
|
||||
|
||||
void LightStateClass::RgbToXy(uint8_t i_r, uint8_t i_g, uint8_t i_b, float *r_x, float *r_y) {
|
||||
float x = 0.31271f; // default medium white
|
||||
float y = 0.32902f;
|
||||
|
|
|
@ -374,21 +374,11 @@ void calculateColorTemperature(void)
|
|||
n = (xc - 0.3320F) / (0.1858F - yc);
|
||||
|
||||
/* Calculate the final CCT */
|
||||
color_data.cct = (449.0F * powf(n, 3)) + (3525.0F * powf(n, 2)) + (6823.3F * n) + 5520.33F;
|
||||
color_data.cct = (449.0F * FastPrecisePowf(n, 3)) + (3525.0F * FastPrecisePowf(n, 2)) + (6823.3F * n) + 5520.33F;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Taken from the Adafruit-Library
|
||||
* @brief Implements missing powf function
|
||||
*/
|
||||
|
||||
float powf(const float x, const float y)
|
||||
{
|
||||
return (float)(pow((double)x, (double)y));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Getters and setters for register values
|
||||
******************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue