fixing a few implicit promotions to double
any expression with at least on "double" is evaluated as double, which is slow.
This commit is contained in:
parent
e40f266042
commit
da0cf01eee
@ -189,7 +189,7 @@ void handleTransitions()
|
|||||||
if (transitionActive && transitionDelayTemp > 0)
|
if (transitionActive && transitionDelayTemp > 0)
|
||||||
{
|
{
|
||||||
float tper = (millis() - transitionStartTime)/(float)transitionDelayTemp;
|
float tper = (millis() - transitionStartTime)/(float)transitionDelayTemp;
|
||||||
if (tper >= 1.0)
|
if (tper >= 1.0f)
|
||||||
{
|
{
|
||||||
strip.setTransitionMode(false);
|
strip.setTransitionMode(false);
|
||||||
transitionActive = false;
|
transitionActive = false;
|
||||||
|
@ -25,7 +25,7 @@ bool parseLx(int lxValue, byte* rgbw)
|
|||||||
float tmpBri = floor((lxValue - 200000000) / 10000); ;
|
float tmpBri = floor((lxValue - 200000000) / 10000); ;
|
||||||
uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000);
|
uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000);
|
||||||
|
|
||||||
tmpBri *= 2.55;
|
tmpBri *= 2.55f;
|
||||||
tmpBri = constrain(tmpBri, 0, 255);
|
tmpBri = constrain(tmpBri, 0, 255);
|
||||||
|
|
||||||
colorKtoRGB(ct, rgbw);
|
colorKtoRGB(ct, rgbw);
|
||||||
|
@ -520,7 +520,7 @@ um_data_t* simulateSound(uint8_t simulationId)
|
|||||||
maxVol = 31; // this gets feedback fro UI
|
maxVol = 31; // this gets feedback fro UI
|
||||||
binNum = 8; // this gets feedback fro UI
|
binNum = 8; // this gets feedback fro UI
|
||||||
volumeRaw = volumeSmth;
|
volumeRaw = volumeSmth;
|
||||||
my_magnitude = 10000.0 / 8.0f; //no idea if 10000 is a good value for FFT_Magnitude ???
|
my_magnitude = 10000.0f / 8.0f; //no idea if 10000 is a good value for FFT_Magnitude ???
|
||||||
if (volumeSmth < 1 ) my_magnitude = 0.001f; // noise gate closed - mute
|
if (volumeSmth < 1 ) my_magnitude = 0.001f; // noise gate closed - mute
|
||||||
|
|
||||||
return um_data;
|
return um_data;
|
||||||
|
@ -41,7 +41,7 @@ float sin_t(float x) {
|
|||||||
|
|
||||||
float tan_t(float x) {
|
float tan_t(float x) {
|
||||||
float c = cos_t(x);
|
float c = cos_t(x);
|
||||||
if (c==0.0) return 0;
|
if (c==0.0f) return 0;
|
||||||
float res = sin_t(x) / c;
|
float res = sin_t(x) / c;
|
||||||
#ifdef WLED_DEBUG_MATH
|
#ifdef WLED_DEBUG_MATH
|
||||||
Serial.printf("tan: %f,%f,%f,(%f)\n",x,res,tan(x),res-tan(x));
|
Serial.printf("tan: %f,%f,%f,(%f)\n",x,res,tan(x),res-tan(x));
|
||||||
@ -54,14 +54,14 @@ float tan_t(float x) {
|
|||||||
float acos_t(float x) {
|
float acos_t(float x) {
|
||||||
float negate = float(x < 0);
|
float negate = float(x < 0);
|
||||||
float xabs = std::abs(x);
|
float xabs = std::abs(x);
|
||||||
float ret = -0.0187293;
|
float ret = -0.0187293f;
|
||||||
ret = ret * xabs;
|
ret = ret * xabs;
|
||||||
ret = ret + 0.0742610;
|
ret = ret + 0.0742610f;
|
||||||
ret = ret * xabs;
|
ret = ret * xabs;
|
||||||
ret = ret - 0.2121144;
|
ret = ret - 0.2121144f;
|
||||||
ret = ret * xabs;
|
ret = ret * xabs;
|
||||||
ret = ret + HALF_PI;
|
ret = ret + HALF_PI;
|
||||||
ret = ret * sqrt(1.0-xabs);
|
ret = ret * sqrt(1.0f-xabs);
|
||||||
ret = ret - 2 * negate * ret;
|
ret = ret - 2 * negate * ret;
|
||||||
float res = negate * PI + ret;
|
float res = negate * PI + ret;
|
||||||
#ifdef WLED_DEBUG_MATH
|
#ifdef WLED_DEBUG_MATH
|
||||||
|
@ -587,7 +587,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
sappends('s',SET_F("LT"),tm);
|
sappends('s',SET_F("LT"),tm);
|
||||||
getTimeString(tm);
|
getTimeString(tm);
|
||||||
sappends('m',SET_F("(\"times\")[0]"),tm);
|
sappends('m',SET_F("(\"times\")[0]"),tm);
|
||||||
if ((int)(longitude*10.) || (int)(latitude*10.)) {
|
if ((int)(longitude*10.0f) || (int)(latitude*10.0f)) {
|
||||||
sprintf_P(tm, PSTR("Sunrise: %02d:%02d Sunset: %02d:%02d"), hour(sunrise), minute(sunrise), hour(sunset), minute(sunset));
|
sprintf_P(tm, PSTR("Sunrise: %02d:%02d Sunset: %02d:%02d"), hour(sunrise), minute(sunrise), hour(sunset), minute(sunset));
|
||||||
sappends('m',SET_F("(\"times\")[1]"),tm);
|
sappends('m',SET_F("(\"times\")[1]"),tm);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user