Apply minimum C in M303 (#13113)

Apply minimum `C` in `M303`. `PID_autotune()` needs to be called with a 'C'ycles-parameter >2 to give meaningful (different from 0) PID-factors. Therefore silently raise C to 3. Fixing one aspect of #13104
This commit is contained in:
AnHardt 2019-02-10 10:54:45 +01:00 committed by Scott Lahteine
parent 5a316664e5
commit 0e37fe8776
2 changed files with 4 additions and 2 deletions

View File

@ -32,7 +32,7 @@
* *
* S<temperature> sets the target temperature. (default 150C / 70C) * S<temperature> sets the target temperature. (default 150C / 70C)
* E<extruder> (-1 for the bed) (default 0) * E<extruder> (-1 for the bed) (default 0)
* C<cycles> * C<cycles> Minimum 3. Default 5.
* U<bool> with a non-zero value will apply the result to current settings * U<bool> with a non-zero value will apply the result to current settings
*/ */
void GcodeSuite::M303() { void GcodeSuite::M303() {

View File

@ -330,6 +330,8 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
* *
* Alternately heat and cool the nozzle, observing its behavior to * Alternately heat and cool the nozzle, observing its behavior to
* determine the best PID values to achieve a stable temperature. * determine the best PID values to achieve a stable temperature.
* Needs sufficient heater power to make some overshoot at target
* temperature to succeed.
*/ */
void Temperature::PID_autotune(const float &target, const int8_t heater, const int8_t ncycles, const bool set_result/*=false*/) { void Temperature::PID_autotune(const float &target, const int8_t heater, const int8_t ncycles, const bool set_result/*=false*/) {
float current = 0.0; float current = 0.0;
@ -540,7 +542,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
break; break;
} }
if (cycles > ncycles) { if (cycles > ncycles && cycles > 2) {
SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_FINISHED); SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_FINISHED);
#if HAS_PID_FOR_BOTH #if HAS_PID_FOR_BOTH