From 2445ae3d3aed0e1dc6da1a4094c543bad1dbbf60 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 10 May 2015 22:52:01 -0700 Subject: [PATCH] Combine thermal runaway and watch-period - Make thermal protection for all hotends and/or bed into simple switches - Now enable `WATCH_TEMP_PERIOD` when `THERMAL_PROTECTION_HOTENDS` is enabled - Move detailed thermal parameters to `Configuration_adv.h` - Add sanity checks to warn about old configurations - Change `WATCH_TEMP_PERIOD` to seconds instead of milliseconds --- Marlin/Configuration.h | 18 +---- Marlin/Configuration_adv.h | 45 ++++++++----- Marlin/Marlin_main.cpp | 4 +- Marlin/SanityCheck.h | 12 ++++ Marlin/configurator/config/Configuration.h | 17 +---- .../configurator/config/Configuration_adv.h | 37 ++++++++--- .../Felix/Configuration.h | 17 +---- .../Felix/Configuration_DUAL.h | 17 +---- .../Felix/Configuration_adv.h | 37 ++++++++--- .../Hephestos/Configuration.h | 17 +---- .../Hephestos/Configuration_adv.h | 37 ++++++++--- .../K8200/Configuration.h | 17 +---- .../K8200/Configuration_adv.h | 37 ++++++++--- .../RepRapWorld/Megatronics/Configuration.h | 66 +++++++------------ .../SCARA/Configuration.h | 17 +---- .../SCARA/Configuration_adv.h | 37 ++++++++--- .../WITBOX/Configuration.h | 17 +---- .../WITBOX/Configuration_adv.h | 37 ++++++++--- .../delta/biv2.5/Configuration.h | 17 +---- .../delta/biv2.5/Configuration_adv.h | 37 ++++++++--- .../delta/generic/Configuration.h | 17 +---- .../delta/generic/Configuration_adv.h | 37 ++++++++--- .../delta/kossel_mini/Configuration.h | 17 +---- .../delta/kossel_mini/Configuration_adv.h | 37 ++++++++--- .../makibox/Configuration.h | 17 +---- .../makibox/Configuration_adv.h | 37 ++++++++--- .../tvrrug/Round2/Configuration.h | 17 +---- .../tvrrug/Round2/Configuration_adv.h | 37 ++++++++--- Marlin/temperature.cpp | 32 +++++---- Marlin/temperature.h | 2 +- 30 files changed, 428 insertions(+), 362 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 6f2333de8..823fadc14 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -284,24 +284,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius - +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b40615524..89d8e2716 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -15,15 +15,26 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. @@ -34,14 +45,16 @@ #endif #endif - -//automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode. -//The maximum buffered steps/sec of the extruder motor are called "se". -//You enter the autotemp mode by a M109 S B F -// the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp -// you exit the value by any M109 without F* -// Also, if the temperature is set to a value B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #define AUTOTEMP #ifdef AUTOTEMP #define AUTOTEMP_OLDWEIGHT 0.98 diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index ed57d2b9c..5427e107d 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3167,7 +3167,7 @@ inline void gcode_M104() { setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset); #endif - #ifdef WATCH_TEMP_PERIOD + #ifdef THERMAL_PROTECTION_HOTENDS start_watching_heater(target_extruder); #endif } @@ -3281,7 +3281,7 @@ inline void gcode_M109() { if (code_seen('B')) autotemp_max = code_value(); #endif - #ifdef WATCH_TEMP_PERIOD + #ifdef THERMAL_PROTECTION_HOTENDS start_watching_heater(target_extruder); #endif diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 3bba4584c..a0e2138e3 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -313,4 +313,16 @@ #error [XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM #endif + #if WATCH_TEMP_PERIOD > 500 + #error WATCH_TEMP_PERIOD now uses seconds instead of milliseconds + #endif + + #if !defined(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD)) + #error Thermal Runaway Protection for hotends must now be enabled with THERMAL_PROTECTION_HOTENDS + #endif + + #if !defined(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD) + #error Thermal Runaway Protection for the bed must now be enabled with THERMAL_PROTECTION_BED + #error + #endif //SANITYCHECK_H diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index 35820a4eb..a807a56e9 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -284,23 +284,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/configurator/config/Configuration_adv.h b/Marlin/configurator/config/Configuration_adv.h index b40615524..c484db4ed 100644 --- a/Marlin/configurator/config/Configuration_adv.h +++ b/Marlin/configurator/config/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 294407367..078af2a0d 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -250,23 +250,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 6c5c50f22..27c2d0c22 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -250,23 +250,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 9384ed553..6bfe76c2c 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 595a63a5b..c5184ac6e 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -271,23 +271,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 58159fe36..344f71e10 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index f39775c6b..f4fccc82a 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -300,23 +300,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 9384ed553..6bfe76c2c 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index c62845989..e922f472a 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -200,8 +200,7 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine - + // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker #define DEFAULT_Kp 22.2 @@ -271,44 +270,24 @@ Here are some standard links for getting your machine calibrated: #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances. //=========================================================================== -//============================= Thermal Runaway Protection ================== +//======================== Thermal Runaway Protection ======================= //=========================================================================== -/* -This is a feature to protect your printer from burn up in flames if it has -a thermistor coming off place (this happened to a friend of mine recently and -motivated me writing this feature). -The issue: If a thermistor come off, it will read a lower temperature than actual. -The system will turn the heater on forever, burning up the filament and anything -else around. - -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target -minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). - -If it stays longer than _PERIOD, it means the thermistor temperature -cannot catch up with the target, so something *may be* wrong. Then, to be on the -safe side, the system will he halt. - -Bear in mind the count down will just start AFTER the first time the -thermistor temperature is over the target, so you will have no problem if -your extruder heater takes 2 minutes to hit the target on heating. - -*/ -// If you want to enable this feature for all your extruder heaters, -// uncomment the 2 defines below: - -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// If you want to enable this feature for your bed heater, -// uncomment the 2 defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +/** + * Thermal Runaway Protection protects your printer from damage and fire if a + * thermistor falls out or temperature sensors fail in any way. + * + * The issue: If a thermistor falls out or a temperature sensor fails, + * Marlin can no longer sense the actual temperature. Since a disconnected + * thermistor reads as a low temperature, the firmware will keep the heater on. + * + * The solution: Once the temperature reaches the target, start observing. + * If the temperature stays too far below the target (hysteresis) for too long, + * the firmware will halt as a safety precaution. + */ +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= @@ -412,17 +391,20 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define Z_MAX_POS 200 //=========================================================================== -//============================= Filament Runout Sensor ====================== +//========================= Filament Runout Sensor ========================== //=========================================================================== //#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made. // It is assumed that when logic high = filament available // when logic low = filament ran out -//const bool FIL_RUNOUT_INVERTING = true; // Should be uncommented and true or false should assigned -//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined. +#ifdef FILAMENT_RUNOUT_SENSOR + const bool FIL_RUNOUT_INVERTING = true; // Should be uncommented and true or false should assigned + #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined. + #define FILAMENT_RUNOUT_SCRIPT "M600" +#endif //=========================================================================== -//============================ Mesh Bed Leveling ============================ +//=========================== Manual Bed Leveling =========================== //=========================================================================== // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling @@ -443,7 +425,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #endif // MESH_BED_LEVELING //=========================================================================== -//============================= Bed Auto Leveling =========================== +//============================ Bed Auto Leveling ============================ //=========================================================================== // @section bedlevel diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 151b70300..d642a811a 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -302,23 +302,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 146e7fab1..1feb0ec4e 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 3000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 218396d13..f0c71c16d 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -270,23 +270,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index a4d8f65f9..0f0807f0e 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index d9874ce94..908acce5a 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -300,23 +300,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 120 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 4 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 0807c999b..eb4f8ae46 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 120 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 4 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 270a3b5dc..0a5b7e671 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -300,23 +300,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 9f1fda4a4..2f5eedc9b 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 85290fb9f..87d1cd2a1 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -300,23 +300,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index b36e8a0f3..d6ea04aca 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 432cd449f..f1f448029 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -270,23 +270,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 411985f79..b36442b48 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index e0f054b5b..0dd00045b 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -272,23 +272,10 @@ Here are some standard links for getting your machine calibrated: * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long, * the firmware will halt as a safety precaution. - * - * Note that because the countdown starts only AFTER the temperature reaches - * the target, this will not catch a thermistor that is already disconnected - * when the print starts! - * - * To enable for all extruder heaters, uncomment the two defines below: */ -// Parameters for all extruder heaters -#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius - -// To enable for the bed heater, uncomment the two defines below: - -// Parameters for the bed heater -#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds -#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed //=========================================================================== //============================= Mechanical Settings ========================= diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 572fdb6bf..976f6a8b8 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -15,16 +15,37 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control /** - * 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. + * Thermal Protection parameters */ -#define WATCH_TEMP_PERIOD 16000 // 16 seconds -#define WATCH_TEMP_INCREASE 4 // Heat up at least 4 degrees in 16 seconds +#ifdef THERMAL_PROTECTION_HOTENDS + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + /** + * Whenever an M104 or M109 increases the target temperature the firmware will wait for the + * WATCH_TEMP_PERIOD to transpire, 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. + */ + #define WATCH_TEMP_PERIOD 16 // Seconds + #define WATCH_TEMP_INCREASE 4 // Degrees Celsius +#endif + +#ifdef THERMAL_PROTECTION_BED + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by excuting M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ #ifdef PIDTEMP // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index e98ab0045..8aee2f73e 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -73,16 +73,14 @@ unsigned char soft_pwm_bed; int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only #endif -#define HAS_HEATER_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0) -#define HAS_BED_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 && TEMP_SENSOR_BED != 0) -#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION +#if THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway }; void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); - #if HAS_HEATER_THERMAL_PROTECTION + #if THERMAL_PROTECTION_HOTENDS static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset }; static millis_t thermal_runaway_timer[4]; // = {0,0,0,0}; #endif - #if HAS_BED_THERMAL_PROTECTION + #if THERMAL_PROTECTION_BED static TRState thermal_runaway_bed_state_machine = TRReset; static millis_t thermal_runaway_bed_timer; #endif @@ -170,7 +168,7 @@ static float analog2temp(int raw, uint8_t e); static float analog2tempBed(int raw); static void updateTemperaturesFromRawValues(); -#ifdef WATCH_TEMP_PERIOD +#ifdef THERMAL_PROTECTION_HOTENDS int watch_target_temp[EXTRUDERS] = { 0 }; millis_t watch_heater_next_ms[EXTRUDERS] = { 0 }; #endif @@ -604,15 +602,15 @@ void manage_heater() { if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); #endif - #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN + #if defined(THERMAL_PROTECTION_HOTENDS) || !defined(PIDTEMPBED) || HAS_AUTO_FAN millis_t ms = millis(); #endif // Loop through all extruders for (int e = 0; e < EXTRUDERS; e++) { - #if HAS_HEATER_THERMAL_PROTECTION - thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_RUNAWAY_PROTECTION_PERIOD, THERMAL_RUNAWAY_PROTECTION_HYSTERESIS); + #if THERMAL_PROTECTION_HOTENDS + thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); #endif float pid_output = get_pid_output(e); @@ -621,7 +619,7 @@ void manage_heater() { 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 + #ifdef THERMAL_PROTECTION_HOTENDS // 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? @@ -635,7 +633,7 @@ void manage_heater() { watch_heater_next_ms[e] = 0; } } - #endif // WATCH_TEMP_PERIOD + #endif // THERMAL_PROTECTION_HOTENDS #ifdef TEMP_SENSOR_1_AS_REDUNDANT if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) { @@ -675,8 +673,8 @@ void manage_heater() { #if TEMP_SENSOR_BED != 0 - #if HAS_BED_THERMAL_PROTECTION - thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_RUNAWAY_PROTECTION_BED_PERIOD, THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS); + #if THERMAL_PROTECTION_BED + thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); #endif #ifdef PIDTEMPBED @@ -999,14 +997,14 @@ void tp_init() { #endif //BED_MAXTEMP } -#ifdef WATCH_TEMP_PERIOD +#ifdef THERMAL_PROTECTION_HOTENDS /** * 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_heater(int e) { - millis_t ms = millis() + WATCH_TEMP_PERIOD; + millis_t ms = millis() + WATCH_TEMP_PERIOD * 1000; if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) { watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE; watch_heater_next_ms[e] = ms; @@ -1016,7 +1014,7 @@ void tp_init() { } #endif -#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION +#if THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) { @@ -1082,7 +1080,7 @@ void tp_init() { } } -#endif // HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION +#endif // THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED void disable_all_heaters() { for (int i=0; i