From 2142e1dae493502adb1a26c9f81c2e6d43b0e02a Mon Sep 17 00:00:00 2001 From: woisy00 Date: Wed, 27 Oct 2021 01:05:34 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20AUTOTEMP=20bug=20(thermal?= =?UTF-8?q?=20runaway)=20(#23025)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression from 9823a37 --- Marlin/Configuration_adv.h | 2 +- Marlin/src/module/planner.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 3e1bd2cce6..3d98aac6ca 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -414,7 +414,7 @@ */ #define AUTOTEMP #if ENABLED(AUTOTEMP) - #define AUTOTEMP_OLDWEIGHT 0.98 + #define AUTOTEMP_OLDWEIGHT 0.98 // Factor used to weight previous readings (0.0 < value < 1.0) // Turn on AUTOTEMP on M104/M109 by default using proportions set here //#define AUTOTEMP_PROPORTIONAL #if ENABLED(AUTOTEMP_PROPORTIONAL) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index b89a313f2b..2552efc69a 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1457,7 +1457,7 @@ void Planner::check_axes_activity() { float t = autotemp_min + high * autotemp_factor; LIMIT(t, autotemp_min, autotemp_max); - if (t < oldt) t *= (1.0f - (AUTOTEMP_OLDWEIGHT)) + oldt * (AUTOTEMP_OLDWEIGHT); + if (t < oldt) t = t * (1.0f - (AUTOTEMP_OLDWEIGHT)) + oldt * (AUTOTEMP_OLDWEIGHT); oldt = t; thermalManager.setTargetHotend(t, active_extruder); }