@@ -27,7 +27,7 @@ QuickPID::QuickPID(int16_t* Input, uint8_t* Output, int16_t* Setpoint,
27
27
mySetpoint = Setpoint;
28
28
inAuto = false ;
29
29
30
- QuickPID::SetOutputLimits (0 , 255 ); // default is same as the arduino PWM limit
30
+ QuickPID::SetOutputLimits (0 , 255 ); // default is same as the arduino PWM limit
31
31
SampleTimeUs = 100000 ; // default is 0.1 seconds
32
32
33
33
QuickPID::SetControllerDirection (ControllerDirection);
@@ -150,24 +150,20 @@ void QuickPID::SetSampleTimeUs(uint32_t NewSampleTimeUs)
150
150
if (NewSampleTimeUs > 0 )
151
151
{
152
152
float ratio = (float )NewSampleTimeUs / (float )SampleTimeUs;
153
- // float ratio = FX_FL(FX_DIV(FL_FX(NewSampleTimeUs), FL_FX(SampleTimeUs)));
154
153
155
154
ki *= ratio;
156
- // ki = FX_FL(FX_MUL(FL_FX(ki), FL_FX(ratio)));
157
-
158
155
kd /= ratio;
159
- // kd = FX_FL(FX_DIV(FL_FX(kd), FL_FX(ratio)));
160
- // ----------------------------------------------------------------------------------------------------------------------------
156
+
161
157
SampleTimeUs = (uint32_t )NewSampleTimeUs;
162
158
}
163
159
}
164
160
165
- /* SetOutputLimits(...)****************************************************
161
+ /* SetOutputLimits(...)********************************************************
166
162
This function will be used far more often than SetInputLimits. While
167
163
the input to the controller will generally be in the 0-1023 range, which is
168
164
the default already, the required output limits might be unique, like using
169
165
a time window of 0-8000 needing to clamp it from 0-125.
170
- **************************************************************************/
166
+ ***************************************************************************** * /
171
167
void QuickPID::SetOutputLimits (uint8_t Min, uint8_t Max)
172
168
{
173
169
if (Min >= Max) return ;
0 commit comments