File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ void loop() {
7474 _myPID.Compute ();
7575 analogWrite (outputPin, Output);
7676 }
77- // delay(1); // adjust loop speed
77+ delay (1 ); // adjust loop speed
7878}
7979
8080float avg (int inputVal) {
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ void loop() {
7575 _myPID.Compute ();
7676 analogWrite (outputPin, Output);
7777 }
78- // delay(1); // adjust loop speed
78+ delay (1 ); // adjust loop speed
7979}
8080
8181float avg (int inputVal) {
Original file line number Diff line number Diff line change @@ -248,14 +248,18 @@ byte AutoTunePID::autoTuneLoop()
248248 break ;
249249 case STABILIZING:
250250 if (_printOrPlotter == 1 ) Serial.print (F (" Stabilizing →" ));
251+ _t0 = millis ();
251252 _peakHigh = _atSetpoint;
252253 _peakLow = _atSetpoint;
253254 (!_direction) ? *_output = 0 : *_output = _atOutput + _outputStep + 5 ;
254255 _autoTuneStage = COARSE;
255256 return AUTOTUNE;
256257 break ;
257258 case COARSE: // coarse adjust
258- delay (2000 );
259+ if (millis () - _t0 < 2000 ) {
260+ return AUTOTUNE;
261+ break ;
262+ }
259263 if (*_input < (_atSetpoint - _hysteresis)) {
260264 (!_direction) ? *_output = _atOutput + _outputStep + 5 : *_output = _atOutput - _outputStep - 5 ;
261265 _autoTuneStage = FINE;
You can’t perform that action at this time.
0 commit comments