From e92e58df1fd72feda692ef1a4ec5cd4e310f6ac9 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Sun, 10 Jul 2016 11:42:49 +0200 Subject: [PATCH] Adjust wait_for_cooling slope Adjust wait_for_cooling slope and drop mintemp for cooling. See https://github.com/MarlinFirmware/Marlin/pull/4169#issuecomment-231544532 --- Marlin/Marlin_main.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 89ab4615aa..31545ab478 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4488,6 +4488,13 @@ inline void gcode_M105() { #endif + #ifndef MIN_COOLING_SLOPE_DEG + #define MIN_COOLING_SLOPE_DEG 1.50 + #endif + #ifndef MIN_COOLING_SLOPE_TIME + #define MIN_COOLING_SLOPE_TIME 60 + #endif + /** * M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating. * Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling. @@ -4600,11 +4607,11 @@ inline void gcode_M109() { // Prevent a wait-forever situation if R is misused i.e. M109 R0 if (wants_to_cool) { - if (temp < (EXTRUDE_MINTEMP) / 2) break; // always break at (default) 85° - // break after 20 seconds if cooling stalls + // break after MIN_COOLING_SLOPE_TIME seconds + // if the temperature did not drop at least MIN_COOLING_SLOPE_DEG if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) { - if (old_temp - temp < 1.0) break; - next_cool_check_ms = now + 20000; + if (old_temp - temp < MIN_COOLING_SLOPE_DEG) break; + next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME; old_temp = temp; } } @@ -4617,6 +4624,13 @@ inline void gcode_M109() { #if HAS_TEMP_BED + #ifndef MIN_COOLING_SLOPE_DEG_BED + #define MIN_COOLING_SLOPE_DEG_BED 1.50 + #endif + #ifndef MIN_COOLING_SLOPE_TIME_BED + #define MIN_COOLING_SLOPE_TIME_BED 60 + #endif + /** * M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating * Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling @@ -4709,11 +4723,11 @@ inline void gcode_M109() { // Prevent a wait-forever situation if R is misused i.e. M190 R0 if (wants_to_cool) { - if (temp < 30.0) break; // always break at 30° - // break after 20 seconds if cooling stalls + // break after MIN_COOLING_SLOPE_TIME_BED seconds + // if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_BED if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) { - if (old_temp - temp < 1.0) break; - next_cool_check_ms = now + 20000; + if (old_temp - temp < MIN_COOLING_SLOPE_DEG_BED) break; + next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME_BED; old_temp = temp; } }