Change double numbers to float in order to prevent unwanted double to float conversion

This commit is contained in:
Mario Hüttel 2020-10-31 01:11:17 +01:00
parent 86f153bf69
commit a3778fcb6e

View File

@ -73,13 +73,13 @@ float pid_sample(struct pid_controller *pid, float deviation)
float output;
if (!pid)
return 0.0;
return 0.0f;
output = deviation * pid->k_p;
/* PID runaway compensation */
if (!(deviation > 0.0f && pid->control_output > pid->output_sat_max - 0.5) &&
!(deviation < 0.0f && pid->control_output < pid->output_sat_min + 0.5)) {
if (!(deviation > 0.0f && pid->control_output > pid->output_sat_max - 0.5f) &&
!(deviation < 0.0f && pid->control_output < pid->output_sat_min + 0.5f)) {
calculate_integral(pid, deviation);
}