|
@@ -153,7 +153,7 @@ static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
|
|
pid->setpoint = setpoint;
|
|
pid->setpoint = setpoint;
|
|
pid->deadband = deadband;
|
|
pid->deadband = deadband;
|
|
pid->integral = int_tofp(integral);
|
|
pid->integral = int_tofp(integral);
|
|
- pid->last_err = setpoint - busy;
|
|
|
|
|
|
+ pid->last_err = int_tofp(setpoint) - int_tofp(busy);
|
|
}
|
|
}
|
|
|
|
|
|
static inline void pid_p_gain_set(struct _pid *pid, int percent)
|
|
static inline void pid_p_gain_set(struct _pid *pid, int percent)
|