diff --git a/components/flow3r_bsp/flow3r_bsp_imu.c b/components/flow3r_bsp/flow3r_bsp_imu.c index 5fb1a09724b75dcc9e3dc5df4964efdb024de9c7..e4439465f01ca5f3cf7feb832debc6570a21ef4e 100644 --- a/components/flow3r_bsp/flow3r_bsp_imu.c +++ b/components/flow3r_bsp/flow3r_bsp_imu.c @@ -791,7 +791,7 @@ static int8_t set_bmp_config( static float lsb_to_mps(int16_t val, float g_range, uint8_t bit_width) { double power = 2; - float half_scale = (float)((pow((double)power, (double)bit_width) / 2.0f)); + float half_scale = powf(power, bit_width) / 2.0f; return (GRAVITY_EARTH * val * g_range) / half_scale; } @@ -801,7 +801,7 @@ static float lsb_to_mps(int16_t val, float g_range, uint8_t bit_width) { static float lsb_to_dps(int16_t val, float dps, uint8_t bit_width) { double power = 2; - float half_scale = (float)((pow((double)power, (double)bit_width) / 2.0f)); + float half_scale = powf(power, bit_width) / 2.0f; return (dps / (half_scale)) * (val); } diff --git a/components/st3m/st3m_audio.c b/components/st3m/st3m_audio.c index 2fef99f3765065ed85643463f3522824956ce473..d8d66aafda14debb8e54736f1b933d303bacb64b 100644 --- a/components/st3m/st3m_audio.c +++ b/components/st3m/st3m_audio.c @@ -145,7 +145,7 @@ static void _audio_headphones_apply(st3m_audio_output_t *out) { float software_volume_dB = vol_dB - hardware_volume_dB; if (software_volume_dB > 0) software_volume_dB = 0; out->volume_software = - (int32_t)(32768 * exp(software_volume_dB * NAT_LOG_DB)); + (int32_t)(32768 * expf(software_volume_dB * NAT_LOG_DB)); } // Output apply function for speaker. @@ -167,7 +167,7 @@ static void _audio_speaker_apply(st3m_audio_output_t *out) { float software_volume_dB = vol_dB - hardware_volume_dB; if (software_volume_dB > 0) software_volume_dB = 0; out->volume_software = - (int32_t)(32768. * exp(software_volume_dB * NAT_LOG_DB)); + (int32_t)(32768. * expf(software_volume_dB * NAT_LOG_DB)); } // Global state structure. Guarded by state_mutex. @@ -446,7 +446,7 @@ void st3m_audio_input_thru_set_mute(bool mute) { float st3m_audio_input_thru_set_volume_dB(float vol_dB) { if (vol_dB > 0) vol_dB = 0; LOCK; - state.input_thru_vol_int = (int32_t)(32768. * exp(vol_dB * NAT_LOG_DB)); + state.input_thru_vol_int = (int32_t)(32768. * expf(vol_dB * NAT_LOG_DB)); state.input_thru_vol = vol_dB; UNLOCK; return vol_dB; diff --git a/components/st3m/st3m_colors.c b/components/st3m/st3m_colors.c index 9069755e380aec8e264ef6246b3441dd2b1cb9fe..d1b231ab7aea2a9935d9d53f8defc6f2ef454ed9 100644 --- a/components/st3m/st3m_colors.c +++ b/components/st3m/st3m_colors.c @@ -3,7 +3,7 @@ #include <math.h> st3m_rgb_t st3m_hsv_to_rgb(st3m_hsv_t hsv) { - double r = 0, g = 0, b = 0; + float r = 0, g = 0, b = 0; if (hsv.s == 0) { r = hsv.v; @@ -11,14 +11,14 @@ st3m_rgb_t st3m_hsv_to_rgb(st3m_hsv_t hsv) { b = hsv.v; } else { int i; - double f, p, q, t; + float f, p, q, t; if (hsv.h == 360) hsv.h = 0; else hsv.h = hsv.h / 60; - i = (int)trunc(hsv.h); + i = (int)truncf(hsv.h); f = hsv.h - i; p = hsv.v * (1.0 - hsv.s); diff --git a/components/st3m/st3m_colors.h b/components/st3m/st3m_colors.h index 450218be76057b7a31a3f07681395299acd55e60..3495e7edcd9a1d865ef3f03543351629089ba4d0 100644 --- a/components/st3m/st3m_colors.h +++ b/components/st3m/st3m_colors.h @@ -13,9 +13,9 @@ typedef struct { typedef struct { // From 0.0 to 1.0. - double h; - double s; - double v; + float h; + float s; + float v; } st3m_hsv_t; // Convert an HSV colour to an RGB colour. diff --git a/components/st3m/st3m_gfx.c b/components/st3m/st3m_gfx.c index 8e26c1860ef8d7accd94a239f085aa9074378868..b22da033c6a18e0dfc27b71fec2061a202011e79 100644 --- a/components/st3m/st3m_gfx.c +++ b/components/st3m/st3m_gfx.c @@ -104,7 +104,7 @@ static void st3m_gfx_crtc_task(void *_arg) { ESP_LOGD( TAG, "blitting: %.3f/sec, read %.3fms, work %.3fms, write %.3fms", - rate, read, work, write); + (double)rate, (double)read, (double)work, (double)write); } } } @@ -160,7 +160,8 @@ static void st3m_gfx_rast_task(void *_arg) { ESP_LOGD(TAG, "rasterization: %.3f/sec, read fb %.3fms, read dctx " "%.3fms, work %.3fms, write %.3fms", - rate, read_fb, read_dctx, work, write); + (double)rate, (double)read_fb, (double)read_dctx, + (double)work, (double)write); } } } diff --git a/components/st3m/st3m_leds.c b/components/st3m/st3m_leds.c index 304b3a51b81d50aa8b3c41b9606907ea97863a69..0a6972655046286272579f593a6b9583284c4647 100644 --- a/components/st3m/st3m_leds.c +++ b/components/st3m/st3m_leds.c @@ -226,9 +226,9 @@ void st3m_leds_set_gamma(float red, float green, float blue) { state.gamma_blue.lut[i] = 0; } float step = ((float)i) / 255.; - state.gamma_red.lut[i] = (uint8_t)(254. * (pow(step, red)) + 1); - state.gamma_green.lut[i] = (uint8_t)(254. * (pow(step, green)) + 1); - state.gamma_blue.lut[i] = (uint8_t)(254. * (pow(step, blue)) + 1); + state.gamma_red.lut[i] = (uint8_t)(254. * (powf(step, red)) + 1); + state.gamma_green.lut[i] = (uint8_t)(254. * (powf(step, green)) + 1); + state.gamma_blue.lut[i] = (uint8_t)(254. * (powf(step, blue)) + 1); } UNLOCK; }