From 9b3d4380d31e0824d85a36e71665ba2f90e34363 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 10 May 2015 20:26:45 -0700 Subject: [PATCH] Only watch the heater that was set --- Marlin/Marlin_main.cpp | 4 ++-- Marlin/temperature.cpp | 18 ++++++++---------- Marlin/temperature.h | 2 +- Marlin/ultralcd.cpp | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4f4e18b58..7b0a7b3d3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3168,7 +3168,7 @@ inline void gcode_M104() { #endif #ifdef WATCH_TEMP_PERIOD - start_watching_heaters(); + start_watching_heater(target_extruder); #endif } } @@ -3282,7 +3282,7 @@ inline void gcode_M109() { #endif #ifdef WATCH_TEMP_PERIOD - start_watching_heaters(); + start_watching_heater(target_extruder); #endif millis_t temp_ms = millis(); diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 94f0a8762..e98ab0045 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1005,16 +1005,14 @@ void tp_init() { * their target temperature by a configurable margin. * This is called when the temperature is set. (M104, M109) */ - void start_watching_heaters() { - millis_t ms = millis() + WATCH_TEMP_PERIOD; - for (int e = 0; e < EXTRUDERS; e++) { - if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) { - watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE; - watch_heater_next_ms[e] = ms; - } - else - watch_heater_next_ms[e] = 0; - } + void start_watching_heater(int e) { + millis_t ms = millis() + WATCH_TEMP_PERIOD; + if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) { + watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE; + watch_heater_next_ms[e] = ms; + } + else + watch_heater_next_ms[e] = 0; } #endif diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 1616d0d11..6a08d09c0 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -138,7 +138,7 @@ void setExtruderAutoFanState(int pin, bool state); void checkExtruderAutoFans(); #ifdef WATCH_TEMP_PERIOD - void start_watching_heaters(); + void start_watching_heater(int e=0); #endif FORCE_INLINE void autotempShutdown() { diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 739e54c07..a1a24dbcd 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -522,7 +522,7 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa fanSpeed = fan; lcd_return_to_status(); #ifdef WATCH_TEMP_PERIOD - start_watching_heaters(); + if (endnum >= 0) start_watching_heater(endnum); #endif } void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }