brewco/pid.c

changeset 454
78242696c15a
parent 448
7fe45f6e4f48
child 473
fdd30e935079
equal deleted inserted replaced
453:76418c89b480 454:78242696c15a
244 double output = pid->Kp * error + pid->ITerm - pid->Kd * dInput; 244 double output = pid->Kp * error + pid->ITerm - pid->Kd * dInput;
245 if (output > pid->outMax) 245 if (output > pid->outMax)
246 output = pid->outMax; 246 output = pid->outMax;
247 else if (output < pid->outMin) 247 else if (output < pid->outMin)
248 output = pid->outMin; 248 output = pid->outMin;
249 *pid->myOutput = output;
249 250
250 /* 251 /*
251 * Remember some variables for the next time 252 * Remember some variables for the next time
252 */ 253 */
253 pid->lastInput = input; 254 pid->lastInput = input;

mercurial