Browse Source

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
Scott Lahteine 9 years ago
parent
commit
2445ae3d3a
30 changed files with 428 additions and 362 deletions
  1. 2
    16
      Marlin/Configuration.h
  2. 29
    16
      Marlin/Configuration_adv.h
  3. 2
    2
      Marlin/Marlin_main.cpp
  4. 12
    0
      Marlin/SanityCheck.h
  5. 2
    15
      Marlin/configurator/config/Configuration.h
  6. 29
    8
      Marlin/configurator/config/Configuration_adv.h
  7. 2
    15
      Marlin/example_configurations/Felix/Configuration.h
  8. 2
    15
      Marlin/example_configurations/Felix/Configuration_DUAL.h
  9. 29
    8
      Marlin/example_configurations/Felix/Configuration_adv.h
  10. 2
    15
      Marlin/example_configurations/Hephestos/Configuration.h
  11. 29
    8
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  12. 2
    15
      Marlin/example_configurations/K8200/Configuration.h
  13. 29
    8
      Marlin/example_configurations/K8200/Configuration_adv.h
  14. 24
    42
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  15. 2
    15
      Marlin/example_configurations/SCARA/Configuration.h
  16. 29
    8
      Marlin/example_configurations/SCARA/Configuration_adv.h
  17. 2
    15
      Marlin/example_configurations/WITBOX/Configuration.h
  18. 29
    8
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  19. 2
    15
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  20. 29
    8
      Marlin/example_configurations/delta/biv2.5/Configuration_adv.h
  21. 2
    15
      Marlin/example_configurations/delta/generic/Configuration.h
  22. 29
    8
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  23. 2
    15
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  24. 29
    8
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  25. 2
    15
      Marlin/example_configurations/makibox/Configuration.h
  26. 29
    8
      Marlin/example_configurations/makibox/Configuration_adv.h
  27. 2
    15
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  28. 29
    8
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  29. 15
    17
      Marlin/temperature.cpp
  30. 1
    1
      Marlin/temperature.h

+ 2
- 16
Marlin/Configuration.h View File

284
  * The solution: Once the temperature reaches the target, start observing.
284
  * The solution: Once the temperature reaches the target, start observing.
285
  * If the temperature stays too far below the target (hysteresis) for too long,
285
  * If the temperature stays too far below the target (hysteresis) for too long,
286
  * the firmware will halt as a safety precaution.
286
  * the firmware will halt as a safety precaution.
287
- *
288
- * Note that because the countdown starts only AFTER the temperature reaches
289
- * the target, this will not catch a thermistor that is already disconnected
290
- * when the print starts!
291
- *
292
- * To enable for all extruder heaters, uncomment the two defines below:
293
  */
287
  */
294
 
288
 
295
-// Parameters for all extruder heaters
296
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
297
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
298
-
299
-// To enable for the bed heater, uncomment the two defines below:
300
-
301
-// Parameters for the bed heater
302
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
303
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
304
-
289
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
290
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
305
 
291
 
306
 //===========================================================================
292
 //===========================================================================
307
 //============================= Mechanical Settings =========================
293
 //============================= Mechanical Settings =========================

+ 29
- 16
Marlin/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
28
 #ifdef PIDTEMP
39
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
40
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
34
   #endif
45
   #endif
35
 #endif
46
 #endif
36
 
47
 
37
-
38
-//automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
39
-//The maximum buffered steps/sec of the extruder motor are called "se".
40
-//You enter the autotemp mode by a M109 S<mintemp> B<maxtemp> F<factor>
41
-// the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
42
-// you exit the value by any M109 without F*
43
-// Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
44
-// on an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+/**
49
+ * Automatic Temperature:
50
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
51
+ * The maximum buffered steps/sec of the extruder motor is called "se".
52
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
53
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
54
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
55
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
56
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
57
+ */
45
 #define AUTOTEMP
58
 #define AUTOTEMP
46
 #ifdef AUTOTEMP
59
 #ifdef AUTOTEMP
47
   #define AUTOTEMP_OLDWEIGHT 0.98
60
   #define AUTOTEMP_OLDWEIGHT 0.98

+ 2
- 2
Marlin/Marlin_main.cpp View File

3167
         setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
3167
         setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
3168
     #endif
3168
     #endif
3169
 
3169
 
3170
-    #ifdef WATCH_TEMP_PERIOD
3170
+    #ifdef THERMAL_PROTECTION_HOTENDS
3171
       start_watching_heater(target_extruder);
3171
       start_watching_heater(target_extruder);
3172
     #endif
3172
     #endif
3173
   }
3173
   }
3281
     if (code_seen('B')) autotemp_max = code_value();
3281
     if (code_seen('B')) autotemp_max = code_value();
3282
   #endif
3282
   #endif
3283
 
3283
 
3284
-  #ifdef WATCH_TEMP_PERIOD
3284
+  #ifdef THERMAL_PROTECTION_HOTENDS
3285
     start_watching_heater(target_extruder);
3285
     start_watching_heater(target_extruder);
3286
   #endif
3286
   #endif
3287
 
3287
 

+ 12
- 0
Marlin/SanityCheck.h View File

313
     #error [XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM
313
     #error [XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM
314
   #endif
314
   #endif
315
 
315
 
316
+  #if WATCH_TEMP_PERIOD > 500
317
+    #error WATCH_TEMP_PERIOD now uses seconds instead of milliseconds
318
+  #endif
319
+
320
+  #if !defined(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD))
321
+    #error Thermal Runaway Protection for hotends must now be enabled with THERMAL_PROTECTION_HOTENDS
322
+  #endif
323
+
324
+  #if !defined(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD)
325
+    #error Thermal Runaway Protection for the bed must now be enabled with THERMAL_PROTECTION_BED
326
+  #error
327
+
316
 #endif //SANITYCHECK_H
328
 #endif //SANITYCHECK_H

+ 2
- 15
Marlin/configurator/config/Configuration.h View File

284
  * The solution: Once the temperature reaches the target, start observing.
284
  * The solution: Once the temperature reaches the target, start observing.
285
  * If the temperature stays too far below the target (hysteresis) for too long,
285
  * If the temperature stays too far below the target (hysteresis) for too long,
286
  * the firmware will halt as a safety precaution.
286
  * the firmware will halt as a safety precaution.
287
- *
288
- * Note that because the countdown starts only AFTER the temperature reaches
289
- * the target, this will not catch a thermistor that is already disconnected
290
- * when the print starts!
291
- *
292
- * To enable for all extruder heaters, uncomment the two defines below:
293
  */
287
  */
294
 
288
 
295
-// Parameters for all extruder heaters
296
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
297
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
298
-
299
-// To enable for the bed heater, uncomment the two defines below:
300
-
301
-// Parameters for the bed heater
302
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
303
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
289
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
290
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
304
 
291
 
305
 //===========================================================================
292
 //===========================================================================
306
 //============================= Mechanical Settings =========================
293
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/configurator/config/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/Felix/Configuration.h View File

250
  * The solution: Once the temperature reaches the target, start observing.
250
  * The solution: Once the temperature reaches the target, start observing.
251
  * If the temperature stays too far below the target (hysteresis) for too long,
251
  * If the temperature stays too far below the target (hysteresis) for too long,
252
  * the firmware will halt as a safety precaution.
252
  * the firmware will halt as a safety precaution.
253
- *
254
- * Note that because the countdown starts only AFTER the temperature reaches
255
- * the target, this will not catch a thermistor that is already disconnected
256
- * when the print starts!
257
- *
258
- * To enable for all extruder heaters, uncomment the two defines below:
259
  */
253
  */
260
 
254
 
261
-// Parameters for all extruder heaters
262
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
263
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
264
-
265
-// To enable for the bed heater, uncomment the two defines below:
266
-
267
-// Parameters for the bed heater
268
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
269
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
255
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
256
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
270
 
257
 
271
 //===========================================================================
258
 //===========================================================================
272
 //============================= Mechanical Settings =========================
259
 //============================= Mechanical Settings =========================

+ 2
- 15
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

250
  * The solution: Once the temperature reaches the target, start observing.
250
  * The solution: Once the temperature reaches the target, start observing.
251
  * If the temperature stays too far below the target (hysteresis) for too long,
251
  * If the temperature stays too far below the target (hysteresis) for too long,
252
  * the firmware will halt as a safety precaution.
252
  * the firmware will halt as a safety precaution.
253
- *
254
- * Note that because the countdown starts only AFTER the temperature reaches
255
- * the target, this will not catch a thermistor that is already disconnected
256
- * when the print starts!
257
- *
258
- * To enable for all extruder heaters, uncomment the two defines below:
259
  */
253
  */
260
 
254
 
261
-// Parameters for all extruder heaters
262
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
263
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
264
-
265
-// To enable for the bed heater, uncomment the two defines below:
266
-
267
-// Parameters for the bed heater
268
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
269
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
255
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
256
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
270
 
257
 
271
 //===========================================================================
258
 //===========================================================================
272
 //============================= Mechanical Settings =========================
259
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/Felix/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/Hephestos/Configuration.h View File

271
  * The solution: Once the temperature reaches the target, start observing.
271
  * The solution: Once the temperature reaches the target, start observing.
272
  * If the temperature stays too far below the target (hysteresis) for too long,
272
  * If the temperature stays too far below the target (hysteresis) for too long,
273
  * the firmware will halt as a safety precaution.
273
  * the firmware will halt as a safety precaution.
274
- *
275
- * Note that because the countdown starts only AFTER the temperature reaches
276
- * the target, this will not catch a thermistor that is already disconnected
277
- * when the print starts!
278
- *
279
- * To enable for all extruder heaters, uncomment the two defines below:
280
  */
274
  */
281
 
275
 
282
-// Parameters for all extruder heaters
283
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
284
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
285
-
286
-// To enable for the bed heater, uncomment the two defines below:
287
-
288
-// Parameters for the bed heater
289
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
290
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
276
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
277
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
291
 
278
 
292
 //===========================================================================
279
 //===========================================================================
293
 //============================= Mechanical Settings =========================
280
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/K8200/Configuration.h View File

300
  * The solution: Once the temperature reaches the target, start observing.
300
  * The solution: Once the temperature reaches the target, start observing.
301
  * If the temperature stays too far below the target (hysteresis) for too long,
301
  * If the temperature stays too far below the target (hysteresis) for too long,
302
  * the firmware will halt as a safety precaution.
302
  * the firmware will halt as a safety precaution.
303
- *
304
- * Note that because the countdown starts only AFTER the temperature reaches
305
- * the target, this will not catch a thermistor that is already disconnected
306
- * when the print starts!
307
- *
308
- * To enable for all extruder heaters, uncomment the two defines below:
309
  */
303
  */
310
 
304
 
311
-// Parameters for all extruder heaters
312
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
313
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
314
-
315
-// To enable for the bed heater, uncomment the two defines below:
316
-
317
-// Parameters for the bed heater
318
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
319
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
305
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
306
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
320
 
307
 
321
 //===========================================================================
308
 //===========================================================================
322
 //============================= Mechanical Settings =========================
309
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/K8200/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 24
- 42
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

200
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
200
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
201
   #define PID_INTEGRAL_DRIVE_MAX PID_MAX  //limit for the integral term
201
   #define PID_INTEGRAL_DRIVE_MAX PID_MAX  //limit for the integral term
202
   #define K1 0.95 //smoothing factor within the PID
202
   #define K1 0.95 //smoothing factor within the PID
203
-  #define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
204
-  
203
+
205
 // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
204
 // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
206
 // Ultimaker
205
 // Ultimaker
207
     #define  DEFAULT_Kp 22.2
206
     #define  DEFAULT_Kp 22.2
271
 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
270
 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
272
 
271
 
273
 //===========================================================================
272
 //===========================================================================
274
-//============================= Thermal Runaway Protection ==================
273
+//======================== Thermal Runaway Protection =======================
275
 //===========================================================================
274
 //===========================================================================
276
-/*
277
-This is a feature to protect your printer from burn up in flames if it has
278
-a thermistor coming off place (this happened to a friend of mine recently and
279
-motivated me writing this feature).
280
-
281
-The issue: If a thermistor come off, it will read a lower temperature than actual.
282
-The system will turn the heater on forever, burning up the filament and anything
283
-else around.
284
-
285
-After the temperature reaches the target for the first time, this feature will
286
-start measuring for how long the current temperature stays below the target
287
-minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS).
288
-
289
-If it stays longer than _PERIOD, it means the thermistor temperature
290
-cannot catch up with the target, so something *may be* wrong. Then, to be on the
291
-safe side, the system will he halt.
292
-
293
-Bear in mind the count down will just start AFTER the first time the
294
-thermistor temperature is over the target, so you will have no problem if
295
-your extruder heater takes 2 minutes to hit the target on heating.
296
-
297
-*/
298
-// If you want to enable this feature for all your extruder heaters,
299
-// uncomment the 2 defines below:
300
-
301
-// Parameters for all extruder heaters
302
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds
303
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
304
 
275
 
305
-// If you want to enable this feature for your bed heater,
306
-// uncomment the 2 defines below:
307
-
308
-// Parameters for the bed heater
309
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds
310
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
276
+/**
277
+ * Thermal Runaway Protection protects your printer from damage and fire if a
278
+ * thermistor falls out or temperature sensors fail in any way.
279
+ *
280
+ * The issue: If a thermistor falls out or a temperature sensor fails,
281
+ * Marlin can no longer sense the actual temperature. Since a disconnected
282
+ * thermistor reads as a low temperature, the firmware will keep the heater on.
283
+ *
284
+ * The solution: Once the temperature reaches the target, start observing.
285
+ * If the temperature stays too far below the target (hysteresis) for too long,
286
+ * the firmware will halt as a safety precaution.
287
+ */
311
 
288
 
289
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
290
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
312
 
291
 
313
 //===========================================================================
292
 //===========================================================================
314
 //============================= Mechanical Settings =========================
293
 //============================= Mechanical Settings =========================
412
 #define Z_MAX_POS 200
391
 #define Z_MAX_POS 200
413
 
392
 
414
 //===========================================================================
393
 //===========================================================================
415
-//============================= Filament Runout Sensor ======================
394
+//========================= Filament Runout Sensor ==========================
416
 //===========================================================================
395
 //===========================================================================
417
 //#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
396
 //#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
418
                                  // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
397
                                  // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
419
                                  // It is assumed that when logic high = filament available
398
                                  // It is assumed that when logic high = filament available
420
                                  //                    when logic  low = filament ran out
399
                                  //                    when logic  low = filament ran out
421
-//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
422
-//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
400
+#ifdef FILAMENT_RUNOUT_SENSOR
401
+  const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
402
+  #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
403
+  #define FILAMENT_RUNOUT_SCRIPT "M600"
404
+#endif 
423
 
405
 
424
 //===========================================================================
406
 //===========================================================================
425
-//============================ Mesh Bed Leveling ============================
407
+//=========================== Manual Bed Leveling ===========================
426
 //===========================================================================
408
 //===========================================================================
427
 
409
 
428
 // #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
410
 // #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
443
 #endif  // MESH_BED_LEVELING
425
 #endif  // MESH_BED_LEVELING
444
 
426
 
445
 //===========================================================================
427
 //===========================================================================
446
-//============================= Bed Auto Leveling ===========================
428
+//============================ Bed Auto Leveling ============================
447
 //===========================================================================
429
 //===========================================================================
448
 
430
 
449
 // @section bedlevel
431
 // @section bedlevel

+ 2
- 15
Marlin/example_configurations/SCARA/Configuration.h View File

302
  * The solution: Once the temperature reaches the target, start observing.
302
  * The solution: Once the temperature reaches the target, start observing.
303
  * If the temperature stays too far below the target (hysteresis) for too long,
303
  * If the temperature stays too far below the target (hysteresis) for too long,
304
  * the firmware will halt as a safety precaution.
304
  * the firmware will halt as a safety precaution.
305
- *
306
- * Note that because the countdown starts only AFTER the temperature reaches
307
- * the target, this will not catch a thermistor that is already disconnected
308
- * when the print starts!
309
- *
310
- * To enable for all extruder heaters, uncomment the two defines below:
311
  */
305
  */
312
 
306
 
313
-// Parameters for all extruder heaters
314
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
315
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
316
-
317
-// To enable for the bed heater, uncomment the two defines below:
318
-
319
-// Parameters for the bed heater
320
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
321
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
307
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
308
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
322
 
309
 
323
 //===========================================================================
310
 //===========================================================================
324
 //============================= Mechanical Settings =========================
311
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/SCARA/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 3000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 3000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/WITBOX/Configuration.h View File

270
  * The solution: Once the temperature reaches the target, start observing.
270
  * The solution: Once the temperature reaches the target, start observing.
271
  * If the temperature stays too far below the target (hysteresis) for too long,
271
  * If the temperature stays too far below the target (hysteresis) for too long,
272
  * the firmware will halt as a safety precaution.
272
  * the firmware will halt as a safety precaution.
273
- *
274
- * Note that because the countdown starts only AFTER the temperature reaches
275
- * the target, this will not catch a thermistor that is already disconnected
276
- * when the print starts!
277
- *
278
- * To enable for all extruder heaters, uncomment the two defines below:
279
  */
273
  */
280
 
274
 
281
-// Parameters for all extruder heaters
282
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
283
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
284
-
285
-// To enable for the bed heater, uncomment the two defines below:
286
-
287
-// Parameters for the bed heater
288
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
289
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
275
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
276
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
290
 
277
 
291
 //===========================================================================
278
 //===========================================================================
292
 //============================= Mechanical Settings =========================
279
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

300
  * The solution: Once the temperature reaches the target, start observing.
300
  * The solution: Once the temperature reaches the target, start observing.
301
  * If the temperature stays too far below the target (hysteresis) for too long,
301
  * If the temperature stays too far below the target (hysteresis) for too long,
302
  * the firmware will halt as a safety precaution.
302
  * the firmware will halt as a safety precaution.
303
- *
304
- * Note that because the countdown starts only AFTER the temperature reaches
305
- * the target, this will not catch a thermistor that is already disconnected
306
- * when the print starts!
307
- *
308
- * To enable for all extruder heaters, uncomment the two defines below:
309
  */
303
  */
310
 
304
 
311
-// Parameters for all extruder heaters
312
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
313
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
314
-
315
-// To enable for the bed heater, uncomment the two defines below:
316
-
317
-// Parameters for the bed heater
318
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 120 // in seconds
319
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 4 // in degree Celsius
305
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
306
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
320
 
307
 
321
 //===========================================================================
308
 //===========================================================================
322
 //============================= Mechanical Settings =========================
309
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 120   // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 4 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/delta/generic/Configuration.h View File

300
  * The solution: Once the temperature reaches the target, start observing.
300
  * The solution: Once the temperature reaches the target, start observing.
301
  * If the temperature stays too far below the target (hysteresis) for too long,
301
  * If the temperature stays too far below the target (hysteresis) for too long,
302
  * the firmware will halt as a safety precaution.
302
  * the firmware will halt as a safety precaution.
303
- *
304
- * Note that because the countdown starts only AFTER the temperature reaches
305
- * the target, this will not catch a thermistor that is already disconnected
306
- * when the print starts!
307
- *
308
- * To enable for all extruder heaters, uncomment the two defines below:
309
  */
303
  */
310
 
304
 
311
-// Parameters for all extruder heaters
312
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
313
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
314
-
315
-// To enable for the bed heater, uncomment the two defines below:
316
-
317
-// Parameters for the bed heater
318
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
319
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
305
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
306
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
320
 
307
 
321
 //===========================================================================
308
 //===========================================================================
322
 //============================= Mechanical Settings =========================
309
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

300
  * The solution: Once the temperature reaches the target, start observing.
300
  * The solution: Once the temperature reaches the target, start observing.
301
  * If the temperature stays too far below the target (hysteresis) for too long,
301
  * If the temperature stays too far below the target (hysteresis) for too long,
302
  * the firmware will halt as a safety precaution.
302
  * the firmware will halt as a safety precaution.
303
- *
304
- * Note that because the countdown starts only AFTER the temperature reaches
305
- * the target, this will not catch a thermistor that is already disconnected
306
- * when the print starts!
307
- *
308
- * To enable for all extruder heaters, uncomment the two defines below:
309
  */
303
  */
310
 
304
 
311
-// Parameters for all extruder heaters
312
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
313
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
314
-
315
-// To enable for the bed heater, uncomment the two defines below:
316
-
317
-// Parameters for the bed heater
318
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
319
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
305
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
306
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
320
 
307
 
321
 //===========================================================================
308
 //===========================================================================
322
 //============================= Mechanical Settings =========================
309
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/makibox/Configuration.h View File

270
  * The solution: Once the temperature reaches the target, start observing.
270
  * The solution: Once the temperature reaches the target, start observing.
271
  * If the temperature stays too far below the target (hysteresis) for too long,
271
  * If the temperature stays too far below the target (hysteresis) for too long,
272
  * the firmware will halt as a safety precaution.
272
  * the firmware will halt as a safety precaution.
273
- *
274
- * Note that because the countdown starts only AFTER the temperature reaches
275
- * the target, this will not catch a thermistor that is already disconnected
276
- * when the print starts!
277
- *
278
- * To enable for all extruder heaters, uncomment the two defines below:
279
  */
273
  */
280
 
274
 
281
-// Parameters for all extruder heaters
282
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
283
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
284
-
285
-// To enable for the bed heater, uncomment the two defines below:
286
-
287
-// Parameters for the bed heater
288
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
289
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
275
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
276
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
290
 
277
 
291
 //===========================================================================
278
 //===========================================================================
292
 //============================= Mechanical Settings =========================
279
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/makibox/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 2
- 15
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

272
  * The solution: Once the temperature reaches the target, start observing.
272
  * The solution: Once the temperature reaches the target, start observing.
273
  * If the temperature stays too far below the target (hysteresis) for too long,
273
  * If the temperature stays too far below the target (hysteresis) for too long,
274
  * the firmware will halt as a safety precaution.
274
  * the firmware will halt as a safety precaution.
275
- *
276
- * Note that because the countdown starts only AFTER the temperature reaches
277
- * the target, this will not catch a thermistor that is already disconnected
278
- * when the print starts!
279
- *
280
- * To enable for all extruder heaters, uncomment the two defines below:
281
  */
275
  */
282
 
276
 
283
-// Parameters for all extruder heaters
284
-#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 // in seconds
285
-#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
286
-
287
-// To enable for the bed heater, uncomment the two defines below:
288
-
289
-// Parameters for the bed heater
290
-#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 // in seconds
291
-#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
277
+#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
278
+#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
292
 
279
 
293
 //===========================================================================
280
 //===========================================================================
294
 //============================= Mechanical Settings =========================
281
 //============================= Mechanical Settings =========================

+ 29
- 8
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16
 
16
 
17
 /**
17
 /**
18
- * Heating Sanity Check
19
- *
20
- * Whenever an M104 or M109 increases the target temperature this will wait for WATCH_TEMP_PERIOD milliseconds,
21
- * and if the temperature hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted, requiring a
22
- * hard reset. This test restarts with any M104/M109, but only if the current temperature is below the target
23
- * by at least 2 * WATCH_TEMP_INCREASE degrees celsius.
18
+ * Thermal Protection parameters
24
  */
19
  */
25
-#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
-#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
20
+#ifdef THERMAL_PROTECTION_HOTENDS
21
+  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
22
+  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
23
+
24
+  /**
25
+   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
26
+   * WATCH_TEMP_PERIOD to transpire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
27
+   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
28
+   * but only if the current temperature is below the target by at least 2 * WATCH_TEMP_INCREASE degrees.
29
+   */
30
+  #define WATCH_TEMP_PERIOD 16                        // Seconds
31
+  #define WATCH_TEMP_INCREASE 4                       // Degrees Celsius
32
+#endif
33
+
34
+#ifdef THERMAL_PROTECTION_BED
35
+  #define THERMAL_PROTECTION_BED_PERIOD 20    // Seconds
36
+  #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
37
+#endif
27
 
38
 
39
+/**
40
+ * Automatic Temperature:
41
+ * The hotend target temperature is calculated by all the buffered lines of gcode.
42
+ * The maximum buffered steps/sec of the extruder motor is called "se".
43
+ * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
44
+ * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
45
+ * mintemp and maxtemp. Turn this off by excuting M109 without F*
46
+ * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
47
+ * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
48
+ */
28
 #ifdef PIDTEMP
49
 #ifdef PIDTEMP
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
50
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
30
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.
51
   // if Kc is chosen well, the additional required power due to increased melting should be compensated.

+ 15
- 17
Marlin/temperature.cpp View File

73
   int current_raw_filwidth = 0;  //Holds measured filament diameter - one extruder only
73
   int current_raw_filwidth = 0;  //Holds measured filament diameter - one extruder only
74
 #endif  
74
 #endif  
75
 
75
 
76
-#define HAS_HEATER_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0)
77
-#define HAS_BED_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 && TEMP_SENSOR_BED != 0)
78
-#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
76
+#if THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED
79
   enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway };
77
   enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway };
80
   void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
78
   void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
81
-  #if HAS_HEATER_THERMAL_PROTECTION
79
+  #if THERMAL_PROTECTION_HOTENDS
82
     static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset };
80
     static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset };
83
     static millis_t thermal_runaway_timer[4]; // = {0,0,0,0};
81
     static millis_t thermal_runaway_timer[4]; // = {0,0,0,0};
84
   #endif
82
   #endif
85
-  #if HAS_BED_THERMAL_PROTECTION
83
+  #if THERMAL_PROTECTION_BED
86
     static TRState thermal_runaway_bed_state_machine = TRReset;
84
     static TRState thermal_runaway_bed_state_machine = TRReset;
87
     static millis_t thermal_runaway_bed_timer;
85
     static millis_t thermal_runaway_bed_timer;
88
   #endif
86
   #endif
170
 static float analog2tempBed(int raw);
168
 static float analog2tempBed(int raw);
171
 static void updateTemperaturesFromRawValues();
169
 static void updateTemperaturesFromRawValues();
172
 
170
 
173
-#ifdef WATCH_TEMP_PERIOD
171
+#ifdef THERMAL_PROTECTION_HOTENDS
174
   int watch_target_temp[EXTRUDERS] = { 0 };
172
   int watch_target_temp[EXTRUDERS] = { 0 };
175
   millis_t watch_heater_next_ms[EXTRUDERS] = { 0 };
173
   millis_t watch_heater_next_ms[EXTRUDERS] = { 0 };
176
 #endif
174
 #endif
604
     if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
602
     if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
605
   #endif
603
   #endif
606
 
604
 
607
-  #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN
605
+  #if defined(THERMAL_PROTECTION_HOTENDS) || !defined(PIDTEMPBED) || HAS_AUTO_FAN
608
     millis_t ms = millis();
606
     millis_t ms = millis();
609
   #endif
607
   #endif
610
 
608
 
611
   // Loop through all extruders
609
   // Loop through all extruders
612
   for (int e = 0; e < EXTRUDERS; e++) {
610
   for (int e = 0; e < EXTRUDERS; e++) {
613
 
611
 
614
-    #if HAS_HEATER_THERMAL_PROTECTION
615
-      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);
612
+    #if THERMAL_PROTECTION_HOTENDS
613
+      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);
616
     #endif
614
     #endif
617
 
615
 
618
     float pid_output = get_pid_output(e);
616
     float pid_output = get_pid_output(e);
621
     soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
619
     soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
622
 
620
 
623
     // Check if the temperature is failing to increase
621
     // Check if the temperature is failing to increase
624
-    #ifdef WATCH_TEMP_PERIOD
622
+    #ifdef THERMAL_PROTECTION_HOTENDS
625
       // Is it time to check this extruder's heater?
623
       // Is it time to check this extruder's heater?
626
       if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) {
624
       if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) {
627
         // Has it failed to increase enough?
625
         // Has it failed to increase enough?
635
           watch_heater_next_ms[e] = 0;
633
           watch_heater_next_ms[e] = 0;
636
         }
634
         }
637
       }
635
       }
638
-    #endif // WATCH_TEMP_PERIOD
636
+    #endif // THERMAL_PROTECTION_HOTENDS
639
 
637
 
640
     #ifdef TEMP_SENSOR_1_AS_REDUNDANT
638
     #ifdef TEMP_SENSOR_1_AS_REDUNDANT
641
       if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
639
       if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
675
 
673
 
676
   #if TEMP_SENSOR_BED != 0
674
   #if TEMP_SENSOR_BED != 0
677
   
675
   
678
-    #if HAS_BED_THERMAL_PROTECTION
679
-      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);
676
+    #if THERMAL_PROTECTION_BED
677
+      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);
680
     #endif
678
     #endif
681
 
679
 
682
     #ifdef PIDTEMPBED
680
     #ifdef PIDTEMPBED
999
   #endif //BED_MAXTEMP
997
   #endif //BED_MAXTEMP
1000
 }
998
 }
1001
 
999
 
1002
-#ifdef WATCH_TEMP_PERIOD
1000
+#ifdef THERMAL_PROTECTION_HOTENDS
1003
   /**
1001
   /**
1004
    * Start Heating Sanity Check for hotends that are below
1002
    * Start Heating Sanity Check for hotends that are below
1005
    * their target temperature by a configurable margin.
1003
    * their target temperature by a configurable margin.
1006
    * This is called when the temperature is set. (M104, M109)
1004
    * This is called when the temperature is set. (M104, M109)
1007
    */
1005
    */
1008
   void start_watching_heater(int e) {
1006
   void start_watching_heater(int e) {
1009
-    millis_t ms = millis() + WATCH_TEMP_PERIOD;
1007
+    millis_t ms = millis() + WATCH_TEMP_PERIOD * 1000;
1010
     if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) {
1008
     if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) {
1011
       watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE;
1009
       watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE;
1012
       watch_heater_next_ms[e] = ms;
1010
       watch_heater_next_ms[e] = ms;
1016
   }
1014
   }
1017
 #endif
1015
 #endif
1018
 
1016
 
1019
-#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
1017
+#if THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED
1020
 
1018
 
1021
   void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
1019
   void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
1022
 
1020
 
1082
     }
1080
     }
1083
   }
1081
   }
1084
 
1082
 
1085
-#endif // HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
1083
+#endif // THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED
1086
 
1084
 
1087
 void disable_all_heaters() {
1085
 void disable_all_heaters() {
1088
   for (int i=0; i<EXTRUDERS; i++) setTargetHotend(0, i);
1086
   for (int i=0; i<EXTRUDERS; i++) setTargetHotend(0, i);

+ 1
- 1
Marlin/temperature.h View File

137
 void setExtruderAutoFanState(int pin, bool state);
137
 void setExtruderAutoFanState(int pin, bool state);
138
 void checkExtruderAutoFans();
138
 void checkExtruderAutoFans();
139
 
139
 
140
-#ifdef WATCH_TEMP_PERIOD
140
+#ifdef THERMAL_PROTECTION_HOTENDS
141
   void start_watching_heater(int e=0);
141
   void start_watching_heater(int e=0);
142
 #endif
142
 #endif
143
 
143
 

Loading…
Cancel
Save