From c63cb45268aed3ab50797c0e5510adf3324e1df3 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date: Wed, 5 Oct 2016 08:42:39 -0500
Subject: [PATCH] Fix thermal runaway timeout
---
Marlin/temperature.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp
index c3053cd1c1..f6c8dec36a 100644
--- a/Marlin/temperature.cpp
+++ b/Marlin/temperature.cpp
@@ -1241,12 +1241,12 @@ void Temperature::init() {
*state = TRStable;
// While the temperature is stable watch for a bad temperature
case TRStable:
- if (temperature < tr_target_temperature[heater_index] - hysteresis_degc && ELAPSED(millis(), *timer))
- *state = TRRunaway;
- else {
+ if (temperature >= tr_target_temperature[heater_index] - hysteresis_degc) {
*timer = millis() + period_seconds * 1000UL;
break;
}
+ else if (PENDING(millis(), *timer)) break;
+ *state = TRRunaway;
case TRRunaway:
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), PSTR(MSG_THERMAL_RUNAWAY));
}
--
GitLab