From 0e37fe87767c26675d3e320f2d0eb03ac9af1a3c Mon Sep 17 00:00:00 2001 From: AnHardt Date: Sun, 10 Feb 2019 10:54:45 +0100 Subject: [PATCH] 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 --- Marlin/src/gcode/temperature/M303.cpp | 2 +- Marlin/src/module/temperature.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/temperature/M303.cpp b/Marlin/src/gcode/temperature/M303.cpp index f701277854..874264bcbd 100644 --- a/Marlin/src/gcode/temperature/M303.cpp +++ b/Marlin/src/gcode/temperature/M303.cpp @@ -32,7 +32,7 @@ * * S sets the target temperature. (default 150C / 70C) * E (-1 for the bed) (default 0) - * C + * C Minimum 3. Default 5. * U with a non-zero value will apply the result to current settings */ void GcodeSuite::M303() { diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index cf6e16c24a..b909caf158 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -330,6 +330,8 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; * * Alternately heat and cool the nozzle, observing its behavior to * 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*/) { float current = 0.0; @@ -540,7 +542,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; break; } - if (cycles > ncycles) { + if (cycles > ncycles && cycles > 2) { SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_FINISHED); #if HAS_PID_FOR_BOTH