Browse Source

Merge pull request #2041 from thinkyhead/watch_temp

More thermal protection
Scott Lahteine 10 years ago
parent
commit
4097207c75

+ 10
- 7
Marlin/Configuration_adv.h View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 7
- 2
Marlin/Marlin_main.cpp View File

3166
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
3166
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
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
-    setWatch();
3169
+
3170
+    #ifdef WATCH_TEMP_PERIOD
3171
+      start_watching_heater(target_extruder);
3172
+    #endif
3170
   }
3173
   }
3171
 }
3174
 }
3172
 
3175
 
3278
     if (code_seen('B')) autotemp_max = code_value();
3281
     if (code_seen('B')) autotemp_max = code_value();
3279
   #endif
3282
   #endif
3280
 
3283
 
3281
-  setWatch();
3284
+  #ifdef WATCH_TEMP_PERIOD
3285
+    start_watching_heater(target_extruder);
3286
+  #endif
3282
 
3287
 
3283
   millis_t temp_ms = millis();
3288
   millis_t temp_ms = millis();
3284
 
3289
 

+ 10
- 7
Marlin/configurator/config/Configuration_adv.h View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
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 View File

14
 #endif
14
 #endif
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
-//// 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
 #ifdef PIDTEMP
28
 #ifdef PIDTEMP
26
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
29
   // this adds an experimental additional term to the heating power, proportional to the extrusion speed.

+ 34
- 26
Marlin/temperature.cpp View File

171
 static void updateTemperaturesFromRawValues();
171
 static void updateTemperaturesFromRawValues();
172
 
172
 
173
 #ifdef WATCH_TEMP_PERIOD
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
 #ifndef SOFT_PWM_SCALE
178
 #ifndef SOFT_PWM_SCALE
179
   #define SOFT_PWM_SCALE 0
179
   #define SOFT_PWM_SCALE 0
447
 //
447
 //
448
 // Temperature Error Handlers
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
   if (IsRunning()) {
451
   if (IsRunning()) {
452
     SERIAL_ERROR_START;
452
     SERIAL_ERROR_START;
453
     if (e >= 0) SERIAL_ERRORLN((int)e);
453
     if (e >= 0) SERIAL_ERRORLN((int)e);
454
-    serialprintPGM(msg1);
454
+    serialprintPGM(serial_msg);
455
     MYSERIAL.write('\n');
455
     MYSERIAL.write('\n');
456
     #ifdef ULTRA_LCD
456
     #ifdef ULTRA_LCD
457
-      lcd_setalertstatuspgm(msg2);
457
+      lcd_setalertstatuspgm(lcd_msg);
458
     #endif
458
     #endif
459
   }
459
   }
460
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
460
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
602
     float ct = current_temperature[0];
602
     float ct = current_temperature[0];
603
     if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
603
     if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
604
     if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
604
     if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
605
-  #endif //HEATER_0_USES_MAX6675
605
+  #endif
606
 
606
 
607
   #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN
607
   #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN
608
     millis_t ms = millis();
608
     millis_t ms = millis();
620
     // Check if temperature is within the correct range
620
     // Check if temperature is within the correct range
621
     soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
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
     #ifdef WATCH_TEMP_PERIOD
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
         else {
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
     #ifdef TEMP_SENSOR_1_AS_REDUNDANT
640
     #ifdef TEMP_SENSOR_1_AS_REDUNDANT
638
       if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
641
       if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
639
         disable_all_heaters();
642
         disable_all_heaters();
640
         _temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP));
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
   } // Extruders Loop
647
   } // Extruders Loop
645
 
648
 
996
   #endif //BED_MAXTEMP
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
 #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
1019
 #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
1012
 
1020
 

+ 4
- 1
Marlin/temperature.h View File

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

+ 3
- 1
Marlin/ultralcd.cpp View File

521
   setTargetBed(tempb);
521
   setTargetBed(tempb);
522
   fanSpeed = fan;
522
   fanSpeed = fan;
523
   lcd_return_to_status();
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
 void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
528
 void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
527
 void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
529
 void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }

Loading…
Cancel
Save