MCPcopy Create free account
hub / github.com/br3ttb/Arduino-PID-Library / SetOutputLimits

Method SetOutputLimits

PID_v1.cpp:154–168  ·  view source on GitHub ↗

SetOutputLimits(...)**************************************************** * This function will be used far more often than SetInputLimits. while * the input to the controller will generally be in the 0-1023 range (which is * the default already,) the output will be a little different. maybe they'll * be doing a time window and will need 0-8000 or something. or maybe they'll * want

Source from the content-addressed store, hash-verified

152 * here.
153 **************************************************************************/
154void PID::SetOutputLimits(double Min, double Max)
155{
156 if(Min >= Max) return;
157 outMin = Min;
158 outMax = Max;
159
160 if(inAuto)
161 {
162 if(*myOutput > outMax) *myOutput = outMax;
163 else if(*myOutput < outMin) *myOutput = outMin;
164
165 if(outputSum > outMax) outputSum= outMax;
166 else if(outputSum < outMin) outputSum= outMin;
167 }
168}
169
170/* SetMode(...)****************************************************************
171 * Allows the controller Mode to be set to manual (0) or Automatic (non-zero)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected