mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-03 16:07:43 +00:00
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;
|
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)
|
uint32_t SqrtInt(uint32_t num)
|
||||||
{
|
{
|
||||||
if (num <= 1) {
|
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
|
#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) {
|
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 x = 0.31271f; // default medium white
|
||||||
float y = 0.32902f;
|
float y = 0.32902f;
|
||||||
|
@ -374,21 +374,11 @@ void calculateColorTemperature(void)
|
|||||||
n = (xc - 0.3320F) / (0.1858F - yc);
|
n = (xc - 0.3320F) / (0.1858F - yc);
|
||||||
|
|
||||||
/* Calculate the final CCT */
|
/* 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;
|
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
|
* Getters and setters for register values
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user