From deedb00c18084c6d93d8eb4ea1354a3976f019c2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 8 May 2015 22:25:51 -0700 Subject: [PATCH 1/6] Document WATCH_TEMP_PERIOD --- Marlin/Configuration_adv.h | 4 +- .../configurator/config/Configuration_adv.h | 4 +- .../Felix/Configuration_adv.h | 4 +- .../Hephestos/Configuration_adv.h | 4 +- .../K8200/Configuration_adv.h | 4 +- .../SCARA/Configuration_adv.h | 4 +- .../WITBOX/Configuration_adv.h | 4 +- .../delta/biv2.5/Configuration_adv.h | 4 +- .../delta/generic/Configuration_adv.h | 4 +- .../delta/kossel_mini/Configuration_adv.h | 4 +- .../makibox/Configuration_adv.h | 4 +- .../tvrrug/Round2/Configuration_adv.h | 4 +- Marlin/temperature.cpp | 44 +++++++++++-------- 13 files changed, 50 insertions(+), 42 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b79035ab6..dafb271b5 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/configurator/config/Configuration_adv.h b/Marlin/configurator/config/Configuration_adv.h index b79035ab6..dafb271b5 100644 --- a/Marlin/configurator/config/Configuration_adv.h +++ b/Marlin/configurator/config/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 672b3ff02..52cb51bfe 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 5713373d1..cb736f2cb 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 672b3ff02..52cb51bfe 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index a706696aa..4e90b004b 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 25abd17c2..f3778a715 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index d035073b8..7fb10e3c4 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE #define WATCH_TEMP_PERIOD 40000 //40 seconds #define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index cdfa7c8f9..d90b0d5c0 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 943022c81..e3b87902f 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 8d451fd28..e762a09e7 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 3187150ba..e13987b83 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -17,8 +17,8 @@ //// Heating sanity check: // This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature // If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature -// differ by at least 2x WATCH_TEMP_INCREASE +// It can be reset with another M104/M109. This check is also only triggered if the target temperature and +// the current temperature differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 7bf0b6e53..587b29b0c 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -172,8 +172,8 @@ static void updateTemperaturesFromRawValues(); #ifdef WATCH_TEMP_PERIOD int watch_start_temp[EXTRUDERS] = { 0 }; - millis_t watchmillis[EXTRUDERS] = { 0 }; -#endif //WATCH_TEMP_PERIOD + millis_t watch_heater_next_ms[EXTRUDERS] = { 0 }; +#endif #ifndef SOFT_PWM_SCALE #define SOFT_PWM_SCALE 0 @@ -447,14 +447,14 @@ void checkExtruderAutoFans() // // Temperature Error Handlers // -inline void _temp_error(int e, const char *msg1, const char *msg2) { +inline void _temp_error(int e, const char *serial_msg, const char *lcd_msg) { if (IsRunning()) { SERIAL_ERROR_START; if (e >= 0) SERIAL_ERRORLN((int)e); - serialprintPGM(msg1); + serialprintPGM(serial_msg); MYSERIAL.write('\n'); #ifdef ULTRA_LCD - lcd_setalertstatuspgm(msg2); + lcd_setalertstatuspgm(lcd_msg); #endif } #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE @@ -602,7 +602,7 @@ void manage_heater() { float ct = current_temperature[0]; if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0); if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); - #endif //HEATER_0_USES_MAX6675 + #endif #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN millis_t ms = millis(); @@ -620,26 +620,27 @@ void manage_heater() { // Check if temperature is within the correct range soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0; + // Check if the temperature is failing to increase #ifdef WATCH_TEMP_PERIOD - if (watchmillis[e] && ms > watchmillis[e] + WATCH_TEMP_PERIOD) { + // Is it time to check this extruder's heater? + if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) { + // Has it failed to increase enough? if (degHotend(e) < watch_start_temp[e] + WATCH_TEMP_INCREASE) { - setTargetHotend(0, e); - LCD_MESSAGEPGM(MSG_HEATING_FAILED_LCD); // translatable - SERIAL_ECHO_START; - SERIAL_ECHOLNPGM(MSG_HEATING_FAILED); + // Stop! + _temp_error(e, MSG_HEATING_FAILED, MSG_HEATING_FAILED_LCD); } else { - watchmillis[e] = 0; + watch_heater_next_ms[e] = 0; } } - #endif //WATCH_TEMP_PERIOD + #endif // WATCH_TEMP_PERIOD #ifdef TEMP_SENSOR_1_AS_REDUNDANT if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) { disable_all_heaters(); _temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP)); } - #endif // TEMP_SENSOR_1_AS_REDUNDANT + #endif } // Extruders Loop @@ -996,16 +997,23 @@ void tp_init() { #endif //BED_MAXTEMP } +/** + * Start Heating Sanity Check for hotends that are below + * their target temperature by a configurable margin. + * This is called when the temperature is set. (M104, M109) + */ void setWatch() { #ifdef WATCH_TEMP_PERIOD - millis_t ms = millis(); + millis_t ms = millis() + WATCH_TEMP_PERIOD; for (int e = 0; e < EXTRUDERS; e++) { if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) { watch_start_temp[e] = degHotend(e); - watchmillis[e] = ms; - } + watch_heater_next_ms[e] = ms; + } + else + watch_heater_next_ms[e] = 0; } - #endif + #endif } #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION From 54deb9eea366295100ab9c0c9105dbb841cc826e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 8 May 2015 22:36:02 -0700 Subject: [PATCH 2/6] Enable WATCH_TEMP_PERIOD by default --- Marlin/Configuration_adv.h | 4 +- Marlin/Marlin_main.cpp | 9 ++++- .../configurator/config/Configuration_adv.h | 4 +- .../Felix/Configuration_adv.h | 4 +- .../Hephestos/Configuration_adv.h | 4 +- .../K8200/Configuration_adv.h | 4 +- .../SCARA/Configuration_adv.h | 4 +- .../WITBOX/Configuration_adv.h | 4 +- .../delta/generic/Configuration_adv.h | 4 +- .../delta/kossel_mini/Configuration_adv.h | 4 +- .../makibox/Configuration_adv.h | 4 +- .../tvrrug/Round2/Configuration_adv.h | 4 +- Marlin/temperature.cpp | 39 ++++++++++--------- Marlin/temperature.h | 5 ++- Marlin/ultralcd.cpp | 4 +- 15 files changed, 56 insertions(+), 45 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index dafb271b5..b5e5ef5b1 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 8b719bd49..4f4e18b58 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3166,7 +3166,10 @@ inline void gcode_M104() { if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset); #endif - setWatch(); + + #ifdef WATCH_TEMP_PERIOD + start_watching_heaters(); + #endif } } @@ -3278,7 +3281,9 @@ inline void gcode_M109() { if (code_seen('B')) autotemp_max = code_value(); #endif - setWatch(); + #ifdef WATCH_TEMP_PERIOD + start_watching_heaters(); + #endif millis_t temp_ms = millis(); diff --git a/Marlin/configurator/config/Configuration_adv.h b/Marlin/configurator/config/Configuration_adv.h index dafb271b5..b5e5ef5b1 100644 --- a/Marlin/configurator/config/Configuration_adv.h +++ b/Marlin/configurator/config/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 52cb51bfe..ef80384b1 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index cb736f2cb..14cb8b8b8 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 52cb51bfe..ef80384b1 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 4e90b004b..70c33413a 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index f3778a715..652041bd1 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index d90b0d5c0..f5fbb1b34 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index e3b87902f..6d76091a4 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index e762a09e7..f0662dc8b 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index e13987b83..4a31b86c7 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -//#define WATCH_TEMP_PERIOD 40000 //40 seconds -//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 10000 // 10 seconds +#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 587b29b0c..68a1d6942 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -171,7 +171,7 @@ static float analog2tempBed(int raw); static void updateTemperaturesFromRawValues(); #ifdef WATCH_TEMP_PERIOD - int watch_start_temp[EXTRUDERS] = { 0 }; + int watch_target_temp[EXTRUDERS] = { 0 }; millis_t watch_heater_next_ms[EXTRUDERS] = { 0 }; #endif @@ -625,11 +625,12 @@ void manage_heater() { // Is it time to check this extruder's heater? if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) { // Has it failed to increase enough? - if (degHotend(e) < watch_start_temp[e] + WATCH_TEMP_INCREASE) { + if (degHotend(e) < watch_target_temp[e]) { // Stop! _temp_error(e, MSG_HEATING_FAILED, MSG_HEATING_FAILED_LCD); } else { + // Only check once per M104/M109 watch_heater_next_ms[e] = 0; } } @@ -997,24 +998,24 @@ void tp_init() { #endif //BED_MAXTEMP } -/** - * Start Heating Sanity Check for hotends that are below - * their target temperature by a configurable margin. - * This is called when the temperature is set. (M104, M109) - */ -void setWatch() { - #ifdef WATCH_TEMP_PERIOD - millis_t ms = millis() + WATCH_TEMP_PERIOD; - for (int e = 0; e < EXTRUDERS; e++) { - if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) { - watch_start_temp[e] = degHotend(e); - watch_heater_next_ms[e] = ms; +#ifdef WATCH_TEMP_PERIOD + /** + * Start Heating Sanity Check for hotends that are below + * 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; } - else - watch_heater_next_ms[e] = 0; - } - #endif -} + } +#endif #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION diff --git a/Marlin/temperature.h b/Marlin/temperature.h index f9effaa9e..1616d0d11 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -130,7 +130,6 @@ HOTEND_ROUTINES(0); int getHeaterPower(int heater); void disable_all_heaters(); -void setWatch(); void updatePID(); void PID_autotune(float temp, int extruder, int ncycles); @@ -138,6 +137,10 @@ void PID_autotune(float temp, int extruder, int ncycles); void setExtruderAutoFanState(int pin, bool state); void checkExtruderAutoFans(); +#ifdef WATCH_TEMP_PERIOD + void start_watching_heaters(); +#endif + FORCE_INLINE void autotempShutdown() { #ifdef AUTOTEMP if (autotemp_enabled) { diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 15c20fff3..739e54c07 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -521,7 +521,9 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa setTargetBed(tempb); fanSpeed = fan; lcd_return_to_status(); - setWatch(); // heater sanity check timer + #ifdef WATCH_TEMP_PERIOD + start_watching_heaters(); + #endif } void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } From 6110494a56588e8e65ed20fe85a12477315e7963 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 8 May 2015 22:41:12 -0700 Subject: [PATCH 3/6] =?UTF-8?q?Change=20default=20to=204=C2=B0C=20in=2016s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 4 ++-- Marlin/configurator/config/Configuration_adv.h | 4 ++-- Marlin/example_configurations/Felix/Configuration_adv.h | 4 ++-- Marlin/example_configurations/Hephestos/Configuration_adv.h | 4 ++-- Marlin/example_configurations/K8200/Configuration_adv.h | 4 ++-- Marlin/example_configurations/SCARA/Configuration_adv.h | 4 ++-- Marlin/example_configurations/WITBOX/Configuration_adv.h | 4 ++-- .../example_configurations/delta/biv2.5/Configuration_adv.h | 4 ++-- .../example_configurations/delta/generic/Configuration_adv.h | 4 ++-- .../delta/kossel_mini/Configuration_adv.h | 4 ++-- Marlin/example_configurations/makibox/Configuration_adv.h | 4 ++-- .../example_configurations/tvrrug/Round2/Configuration_adv.h | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b5e5ef5b1..f2a4d0be2 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/configurator/config/Configuration_adv.h b/Marlin/configurator/config/Configuration_adv.h index b5e5ef5b1..f2a4d0be2 100644 --- a/Marlin/configurator/config/Configuration_adv.h +++ b/Marlin/configurator/config/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index ef80384b1..8d1b3ceaf 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 14cb8b8b8..71e953010 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index ef80384b1..8d1b3ceaf 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 70c33413a..380c4816b 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 652041bd1..d167e5c83 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 7fb10e3c4..ff7cdecb7 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 40000 //40 seconds -#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index f5fbb1b34..3566cb6ed 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 6d76091a4..d1b0f8998 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index f0662dc8b..99a61a1b5 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 4a31b86c7..636b81d2d 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -19,8 +19,8 @@ // If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and // the current temperature differ by at least 2x WATCH_TEMP_INCREASE -#define WATCH_TEMP_PERIOD 10000 // 10 seconds -#define WATCH_TEMP_INCREASE 2 // Heat up at least 2 degrees in 10 seconds +#define WATCH_TEMP_PERIOD 16000 // 16 seconds +#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. From 79106638a8296f8adc999a9981f34561159f7907 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 8 May 2015 22:50:08 -0700 Subject: [PATCH 4/6] Fix documentation of heating sanity check --- Marlin/Configuration_adv.h | 13 ++++++++----- Marlin/configurator/config/Configuration_adv.h | 13 ++++++++----- .../Felix/Configuration_adv.h | 13 ++++++++----- .../Hephestos/Configuration_adv.h | 13 ++++++++----- .../K8200/Configuration_adv.h | 13 ++++++++----- .../SCARA/Configuration_adv.h | 13 ++++++++----- .../WITBOX/Configuration_adv.h | 13 ++++++++----- .../delta/biv2.5/Configuration_adv.h | 13 ++++++++----- .../delta/generic/Configuration_adv.h | 13 ++++++++----- .../delta/kossel_mini/Configuration_adv.h | 13 ++++++++----- .../makibox/Configuration_adv.h | 13 ++++++++----- .../tvrrug/Round2/Configuration_adv.h | 13 ++++++++----- 12 files changed, 96 insertions(+), 60 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index f2a4d0be2..b40615524 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/configurator/config/Configuration_adv.h b/Marlin/configurator/config/Configuration_adv.h index f2a4d0be2..b40615524 100644 --- a/Marlin/configurator/config/Configuration_adv.h +++ b/Marlin/configurator/config/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 8d1b3ceaf..9384ed553 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 71e953010..58159fe36 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 8d1b3ceaf..9384ed553 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 380c4816b..146e7fab1 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 3000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index d167e5c83..a4d8f65f9 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index ff7cdecb7..0807c999b 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 3566cb6ed..9f1fda4a4 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index d1b0f8998..b36e8a0f3 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 99a61a1b5..411985f79 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 636b81d2d..572fdb6bf 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -14,11 +14,14 @@ #endif #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control -//// Heating sanity check: -// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. -// It can be reset with another M104/M109. This check is also only triggered if the target temperature and -// the current temperature differ by at least 2x WATCH_TEMP_INCREASE +/** + * Heating Sanity Check + * + * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds, + * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a + * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target + * by at least 2 * WATCH_TEMP_INCREASE degrees celsius. + */ #define WATCH_TEMP_PERIOD 16000 // 16 seconds #define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds From 28c87ec81b405c9eada07621912e673b6aaeeb95 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 8 May 2015 23:17:25 -0700 Subject: [PATCH 5/6] Disable all heaters on temp error --- Marlin/temperature.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 68a1d6942..94f0a8762 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -627,6 +627,7 @@ void manage_heater() { // Has it failed to increase enough? if (degHotend(e) < watch_target_temp[e]) { // Stop! + disable_all_heaters(); _temp_error(e, MSG_HEATING_FAILED, MSG_HEATING_FAILED_LCD); } else { From 9b3d4380d31e0824d85a36e71665ba2f90e34363 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 10 May 2015 20:26:45 -0700 Subject: [PATCH 6/6] 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); }