fixing a few implicit promotions to double

any expression with at least on "double" is evaluated as double, which is slow.
pull/3368/head
Frank 2023-09-09 20:48:17 +02:00
rodzic e40f266042
commit da0cf01eee
5 zmienionych plików z 9 dodań i 9 usunięć

Wyświetl plik

@ -189,7 +189,7 @@ void handleTransitions()
if (transitionActive && transitionDelayTemp > 0)
{
float tper = (millis() - transitionStartTime)/(float)transitionDelayTemp;
if (tper >= 1.0)
if (tper >= 1.0f)
{
strip.setTransitionMode(false);
transitionActive = false;

Wyświetl plik

@ -25,7 +25,7 @@ bool parseLx(int lxValue, byte* rgbw)
float tmpBri = floor((lxValue - 200000000) / 10000); ;
uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000);
tmpBri *= 2.55;
tmpBri *= 2.55f;
tmpBri = constrain(tmpBri, 0, 255);
colorKtoRGB(ct, rgbw);

Wyświetl plik

@ -520,7 +520,7 @@ um_data_t* simulateSound(uint8_t simulationId)
maxVol = 31; // this gets feedback fro UI
binNum = 8; // this gets feedback fro UI
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
return um_data;

Wyświetl plik

@ -41,7 +41,7 @@ float sin_t(float x) {
float tan_t(float x) {
float c = cos_t(x);
if (c==0.0) return 0;
if (c==0.0f) return 0;
float res = sin_t(x) / c;
#ifdef WLED_DEBUG_MATH
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 negate = float(x < 0);
float xabs = std::abs(x);
float ret = -0.0187293;
float ret = -0.0187293f;
ret = ret * xabs;
ret = ret + 0.0742610;
ret = ret + 0.0742610f;
ret = ret * xabs;
ret = ret - 0.2121144;
ret = ret - 0.2121144f;
ret = ret * xabs;
ret = ret + HALF_PI;
ret = ret * sqrt(1.0-xabs);
ret = ret * sqrt(1.0f-xabs);
ret = ret - 2 * negate * ret;
float res = negate * PI + ret;
#ifdef WLED_DEBUG_MATH

Wyświetl plik

@ -587,7 +587,7 @@ void getSettingsJS(byte subPage, char* dest)
sappends('s',SET_F("LT"),tm);
getTimeString(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));
sappends('m',SET_F("(\"times\")[1]"),tm);
}