From a3778fcb6e68d22cd111b23de49bc938e2af5a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sat, 31 Oct 2020 01:11:17 +0100 Subject: [PATCH] Change double numbers to float in order to prevent unwanted double to float conversion --- stm-firmware/pid-controller.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stm-firmware/pid-controller.c b/stm-firmware/pid-controller.c index b41f0f6..463008f 100644 --- a/stm-firmware/pid-controller.c +++ b/stm-firmware/pid-controller.c @@ -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); }