--- a/brewco/pid.c Sun Dec 06 12:34:44 2015 +0100 +++ b/brewco/pid.c Sun Dec 06 14:29:37 2015 +0100 @@ -40,7 +40,7 @@ pid->inAuto = FALSE; PID_setOutputLimits(pid, 0, 255); pid->SampleTime = 100; - PID_setControllerDirection(pid, ControllerDirection); + PID_setDirection(pid, ControllerDirection); PID_setTunings(pid, Kp, Ki, Kd); pid->lastTime = millis() - pid->SampleTime; } @@ -136,7 +136,7 @@ * know which one, because otherwise we may increase the output when we should * be decreasing. This is called from PID_init(). */ -void PID_setControllerDirection(pid_var *pid, int Direction) +void PID_setDirection(pid_var *pid, int Direction) { if (pid->inAuto && Direction != pid->Direction) { pid->Kp = (0 - pid->Kp); @@ -204,6 +204,13 @@ +int PID_getSampleTime(pid_var *pid) +{ + return pid->SampleTime; +} + + + /* * This, as they say, is where the magic happens. this function should be called * every time "void loop()" executes. the function will decide for itself whether a new