Просмотр исходного кода

Merge pull request #2041 from thinkyhead/watch_temp

More thermal protection
Scott Lahteine 10 лет назад
Родитель
Сommit
4097207c75

+ 10
- 7
Marlin/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 7
- 2
Marlin/Marlin_main.cpp Просмотреть файл

@@ -3166,7 +3166,10 @@ inline void gcode_M104() {
3166 3166
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
3167 3167
         setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
3168 3168
     #endif
3169
-    setWatch();
3169
+
3170
+    #ifdef WATCH_TEMP_PERIOD
3171
+      start_watching_heater(target_extruder);
3172
+    #endif
3170 3173
   }
3171 3174
 }
3172 3175
 
@@ -3278,7 +3281,9 @@ inline void gcode_M109() {
3278 3281
     if (code_seen('B')) autotemp_max = code_value();
3279 3282
   #endif
3280 3283
 
3281
-  setWatch();
3284
+  #ifdef WATCH_TEMP_PERIOD
3285
+    start_watching_heater(target_extruder);
3286
+  #endif
3282 3287
 
3283 3288
   millis_t temp_ms = millis();
3284 3289
 

+ 10
- 7
Marlin/configurator/config/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/Felix/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/Hephestos/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/K8200/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/SCARA/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 3000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/WITBOX/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/delta/generic/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/makibox/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 10
- 7
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h Просмотреть файл

@@ -14,13 +14,16 @@
14 14
 #endif
15 15
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
16 16
 
17
-//// Heating sanity check:
18
-// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
19
-// If the temperature has not increased at the end of that period, the target temperature is set to zero.
20
-// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
21
-//  differ by at least 2x WATCH_TEMP_INCREASE
22
-//#define WATCH_TEMP_PERIOD 40000 //40 seconds
23
-//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
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.
24
+ */
25
+#define WATCH_TEMP_PERIOD 16000 // 16 seconds
26
+#define WATCH_TEMP_INCREASE 4  // Heat up at least 4 degrees in 16 seconds
24 27
 
25 28
 #ifdef PIDTEMP
26 29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 34
- 26
Marlin/temperature.cpp Просмотреть файл

@@ -171,9 +171,9 @@ static float analog2tempBed(int raw);
171 171
 static void updateTemperaturesFromRawValues();
172 172
 
173 173
 #ifdef WATCH_TEMP_PERIOD
174
-  int watch_start_temp[EXTRUDERS] = { 0 };
175
-  millis_t watchmillis[EXTRUDERS] = { 0 };
176
-#endif //WATCH_TEMP_PERIOD
174
+  int watch_target_temp[EXTRUDERS] = { 0 };
175
+  millis_t watch_heater_next_ms[EXTRUDERS] = { 0 };
176
+#endif
177 177
 
178 178
 #ifndef SOFT_PWM_SCALE
179 179
   #define SOFT_PWM_SCALE 0
@@ -447,14 +447,14 @@ void checkExtruderAutoFans()
447 447
 //
448 448
 // Temperature Error Handlers
449 449
 //
450
-inline void _temp_error(int e, const char *msg1, const char *msg2) {
450
+inline void _temp_error(int e, const char *serial_msg, const char *lcd_msg) {
451 451
   if (IsRunning()) {
452 452
     SERIAL_ERROR_START;
453 453
     if (e >= 0) SERIAL_ERRORLN((int)e);
454
-    serialprintPGM(msg1);
454
+    serialprintPGM(serial_msg);
455 455
     MYSERIAL.write('\n');
456 456
     #ifdef ULTRA_LCD
457
-      lcd_setalertstatuspgm(msg2);
457
+      lcd_setalertstatuspgm(lcd_msg);
458 458
     #endif
459 459
   }
460 460
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
@@ -602,7 +602,7 @@ void manage_heater() {
602 602
     float ct = current_temperature[0];
603 603
     if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
604 604
     if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
605
-  #endif //HEATER_0_USES_MAX6675
605
+  #endif
606 606
 
607 607
   #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN
608 608
     millis_t ms = millis();
@@ -620,26 +620,29 @@ void manage_heater() {
620 620
     // Check if temperature is within the correct range
621 621
     soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
622 622
 
623
+    // Check if the temperature is failing to increase
623 624
     #ifdef WATCH_TEMP_PERIOD
624
-      if (watchmillis[e] && ms > watchmillis[e] + WATCH_TEMP_PERIOD) {
625
-        if (degHotend(e) < watch_start_temp[e] + WATCH_TEMP_INCREASE) {
626
-          setTargetHotend(0, e);
627
-          LCD_MESSAGEPGM(MSG_HEATING_FAILED_LCD); // translatable
628
-          SERIAL_ECHO_START;
629
-          SERIAL_ECHOLNPGM(MSG_HEATING_FAILED);
625
+      // Is it time to check this extruder's heater?
626
+      if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) {
627
+        // Has it failed to increase enough?
628
+        if (degHotend(e) < watch_target_temp[e]) {
629
+          // Stop!
630
+          disable_all_heaters();
631
+          _temp_error(e, MSG_HEATING_FAILED, MSG_HEATING_FAILED_LCD);
630 632
         }
631 633
         else {
632
-          watchmillis[e] = 0;
634
+          // Only check once per M104/M109
635
+          watch_heater_next_ms[e] = 0;
633 636
         }
634 637
       }
635
-    #endif //WATCH_TEMP_PERIOD
638
+    #endif // WATCH_TEMP_PERIOD
636 639
 
637 640
     #ifdef TEMP_SENSOR_1_AS_REDUNDANT
638 641
       if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
639 642
         disable_all_heaters();
640 643
         _temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP));
641 644
       }
642
-    #endif // TEMP_SENSOR_1_AS_REDUNDANT
645
+    #endif
643 646
 
644 647
   } // Extruders Loop
645 648
 
@@ -996,17 +999,22 @@ void tp_init() {
996 999
   #endif //BED_MAXTEMP
997 1000
 }
998 1001
 
999
-void setWatch() {
1000
-  #ifdef WATCH_TEMP_PERIOD
1001
-    millis_t ms = millis();
1002
-    for (int e = 0; e < EXTRUDERS; e++) {
1003
-      if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) {
1004
-        watch_start_temp[e] = degHotend(e);
1005
-        watchmillis[e] = ms;
1006
-      } 
1002
+#ifdef WATCH_TEMP_PERIOD
1003
+  /**
1004
+   * Start Heating Sanity Check for hotends that are below
1005
+   * their target temperature by a configurable margin.
1006
+   * This is called when the temperature is set. (M104, M109)
1007
+   */
1008
+  void start_watching_heater(int e) {
1009
+    millis_t ms = millis() + WATCH_TEMP_PERIOD;
1010
+    if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) {
1011
+      watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE;
1012
+      watch_heater_next_ms[e] = ms;
1007 1013
     }
1008
-  #endif 
1009
-}
1014
+    else
1015
+      watch_heater_next_ms[e] = 0;
1016
+  }
1017
+#endif
1010 1018
 
1011 1019
 #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
1012 1020
 

+ 4
- 1
Marlin/temperature.h Просмотреть файл

@@ -130,7 +130,6 @@ HOTEND_ROUTINES(0);
130 130
 
131 131
 int getHeaterPower(int heater);
132 132
 void disable_all_heaters();
133
-void setWatch();
134 133
 void updatePID();
135 134
 
136 135
 void PID_autotune(float temp, int extruder, int ncycles);
@@ -138,6 +137,10 @@ void PID_autotune(float temp, int extruder, int ncycles);
138 137
 void setExtruderAutoFanState(int pin, bool state);
139 138
 void checkExtruderAutoFans();
140 139
 
140
+#ifdef WATCH_TEMP_PERIOD
141
+  void start_watching_heater(int e=0);
142
+#endif
143
+
141 144
 FORCE_INLINE void autotempShutdown() {
142 145
   #ifdef AUTOTEMP
143 146
     if (autotemp_enabled) {

+ 3
- 1
Marlin/ultralcd.cpp Просмотреть файл

@@ -521,7 +521,9 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
521 521
   setTargetBed(tempb);
522 522
   fanSpeed = fan;
523 523
   lcd_return_to_status();
524
-  setWatch(); // heater sanity check timer
524
+  #ifdef WATCH_TEMP_PERIOD
525
+    if (endnum >= 0) start_watching_heater(endnum);
526
+  #endif
525 527
 }
526 528
 void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
527 529
 void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }

Загрузка…
Отмена
Сохранить