From ea8c3a9388f74ab1a05f5261b3373a1682575899 Mon Sep 17 00:00:00 2001 From: espr14 Date: Tue, 7 Jul 2020 01:52:21 +0200 Subject: [PATCH] Reduce 'first loop' temperature residency time (#18421) Co-authored-by: Scott Lahteine --- Marlin/src/module/temperature.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 1afe5c4e4..ff7f69e5c 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -3100,9 +3100,7 @@ void Temperature::tick() { if (!residency_start_ms) { // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time. if (temp_diff < TEMP_WINDOW) { - residency_start_ms = now; - if (first_loop) residency_start_ms += SEC_TO_MS(TEMP_RESIDENCY_TIME); - } + residency_start_ms = now + (first_loop ? SEC_TO_MS(TEMP_RESIDENCY_TIME) / 3 : 0); } else if (temp_diff > TEMP_HYSTERESIS) { // Restart the timer whenever the temperature falls outside the hysteresis. @@ -3227,10 +3225,8 @@ void Temperature::tick() { if (!residency_start_ms) { // Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time. - if (temp_diff < TEMP_BED_WINDOW) { - residency_start_ms = now; - if (first_loop) residency_start_ms += SEC_TO_MS(TEMP_BED_RESIDENCY_TIME); - } + if (temp_diff < TEMP_BED_WINDOW) + residency_start_ms = now + (first_loop ? SEC_TO_MS(TEMP_BED_RESIDENCY_TIME) / 3 : 0); } else if (temp_diff > TEMP_BED_HYSTERESIS) { // Restart the timer whenever the temperature falls outside the hysteresis. @@ -3319,7 +3315,7 @@ void Temperature::tick() { } now = millis(); - if (ELAPSED(now, next_temp_ms)) { //Print Temp Reading every 1 second while heating up. + if (ELAPSED(now, next_temp_ms)) { // Print Temp Reading every 1 second while heating up. next_temp_ms = now + 1000UL; print_heater_states(active_extruder); #if TEMP_CHAMBER_RESIDENCY_TIME > 0 @@ -3343,10 +3339,8 @@ void Temperature::tick() { if (!residency_start_ms) { // Start the TEMP_CHAMBER_RESIDENCY_TIME timer when we reach target temp for the first time. - if (temp_diff < TEMP_CHAMBER_WINDOW) { - residency_start_ms = now; - if (first_loop) residency_start_ms += SEC_TO_MS(TEMP_CHAMBER_RESIDENCY_TIME); - } + if (temp_diff < TEMP_CHAMBER_WINDOW) + residency_start_ms = now + (first_loop ? SEC_TO_MS(TEMP_CHAMBER_RESIDENCY_TIME) / 3 : 0); } else if (temp_diff > TEMP_CHAMBER_HYSTERESIS) { // Restart the timer whenever the temperature falls outside the hysteresis.