Sfoglia il codice sorgente

Fix: Thermal runaway if nonexistent bed's temp is set

Scott Lahteine 7 anni fa
parent
commit
699310d1d2
4 ha cambiato i file con 21 aggiunte e 24 eliminazioni
  1. 3
    0
      Marlin/Conditionals_post.h
  2. 7
    7
      Marlin/temperature.cpp
  3. 6
    6
      Marlin/temperature.h
  4. 5
    11
      Marlin/ultralcd.cpp

+ 3
- 0
Marlin/Conditionals_post.h Vedi File

@@ -522,6 +522,9 @@
522 522
 
523 523
   #define HAS_THERMALLY_PROTECTED_BED (HAS_TEMP_BED && HAS_HEATER_BED && ENABLED(THERMAL_PROTECTION_BED))
524 524
 
525
+  #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
526
+  #define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
527
+
525 528
   /**
526 529
    * This setting is also used by M109 when trying to calculate
527 530
    * a ballpark safe margin to prevent wait-forever situation.

+ 7
- 7
Marlin/temperature.cpp Vedi File

@@ -104,12 +104,12 @@ uint8_t Temperature::soft_pwm_bed;
104 104
   volatile int Temperature::babystepsTodo[XYZ] = { 0 };
105 105
 #endif
106 106
 
107
-#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
107
+#if WATCH_HOTENDS
108 108
   int Temperature::watch_target_temp[HOTENDS] = { 0 };
109 109
   millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
110 110
 #endif
111 111
 
112
-#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
112
+#if WATCH_THE_BED
113 113
   int Temperature::watch_target_bed_temp = 0;
114 114
   millis_t Temperature::watch_bed_next_ms = 0;
115 115
 #endif
@@ -690,7 +690,7 @@ void Temperature::manage_heater() {
690 690
     if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + 0.01)) min_temp_error(0);
691 691
   #endif
692 692
 
693
-  #if (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) || (ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
693
+  #if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
694 694
     millis_t ms = millis();
695 695
   #endif
696 696
 
@@ -707,7 +707,7 @@ void Temperature::manage_heater() {
707 707
     soft_pwm[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
708 708
 
709 709
     // Check if the temperature is failing to increase
710
-    #if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
710
+    #if WATCH_HOTENDS
711 711
 
712 712
       // Is it time to check this extruder's heater?
713 713
       if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) {
@@ -725,7 +725,7 @@ void Temperature::manage_heater() {
725 725
     #endif // THERMAL_PROTECTION_HOTENDS
726 726
 
727 727
     // Check if the temperature is failing to increase
728
-    #if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
728
+    #if WATCH_THE_BED
729 729
 
730 730
       // Is it time to check the bed?
731 731
       if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {
@@ -1157,7 +1157,7 @@ void Temperature::init() {
1157 1157
   #endif //BED_MAXTEMP
1158 1158
 }
1159 1159
 
1160
-#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
1160
+#if WATCH_HOTENDS
1161 1161
   /**
1162 1162
    * Start Heating Sanity Check for hotends that are below
1163 1163
    * their target temperature by a configurable margin.
@@ -1176,7 +1176,7 @@ void Temperature::init() {
1176 1176
   }
1177 1177
 #endif
1178 1178
 
1179
-#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
1179
+#if WATCH_THE_BED
1180 1180
   /**
1181 1181
    * Start Heating Sanity Check for hotends that are below
1182 1182
    * their target temperature by a configurable margin.

+ 6
- 6
Marlin/temperature.h Vedi File

@@ -113,12 +113,12 @@ class Temperature {
113 113
       static volatile int babystepsTodo[3];
114 114
     #endif
115 115
 
116
-    #if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
116
+    #if WATCH_HOTENDS
117 117
       static int watch_target_temp[HOTENDS];
118 118
       static millis_t watch_heater_next_ms[HOTENDS];
119 119
     #endif
120 120
 
121
-    #if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
121
+    #if WATCH_THE_BED
122 122
       static int watch_target_bed_temp;
123 123
       static millis_t watch_bed_next_ms;
124 124
     #endif
@@ -306,11 +306,11 @@ class Temperature {
306 306
     }
307 307
     static float degTargetBed() { return target_temperature_bed; }
308 308
 
309
-    #if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
309
+    #if WATCH_HOTENDS
310 310
       static void start_watching_heater(uint8_t e = 0);
311 311
     #endif
312 312
 
313
-    #if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
313
+    #if WATCH_THE_BED
314 314
       static void start_watching_bed();
315 315
     #endif
316 316
 
@@ -325,14 +325,14 @@ class Temperature {
325 325
           start_preheat_time(HOTEND_INDEX);
326 326
       #endif
327 327
       target_temperature[HOTEND_INDEX] = celsius;
328
-      #if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
328
+      #if WATCH_HOTENDS
329 329
         start_watching_heater(HOTEND_INDEX);
330 330
       #endif
331 331
     }
332 332
 
333 333
     static void setTargetBed(const float& celsius) {
334 334
       target_temperature_bed = celsius;
335
-      #if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
335
+      #if WATCH_THE_BED
336 336
         start_watching_bed();
337 337
       #endif
338 338
     }

+ 5
- 11
Marlin/ultralcd.cpp Vedi File

@@ -918,7 +918,7 @@ void kill_screen(const char* lcd_msg) {
918 918
   /**
919 919
    * Watch temperature callbacks
920 920
    */
921
-  #if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
921
+  #if WATCH_HOTENDS
922 922
     #if TEMP_SENSOR_0 != 0
923 923
       void watch_temp_callback_E0() { thermalManager.start_watching_heater(0); }
924 924
     #endif
@@ -946,14 +946,8 @@ void kill_screen(const char* lcd_msg) {
946 946
     #endif // HOTENDS > 3
947 947
   #endif
948 948
 
949
-  #if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
950
-    #if TEMP_SENSOR_BED != 0
951
-      void watch_temp_callback_bed() { thermalManager.start_watching_bed(); }
952
-    #endif
953
-  #else
954
-    #if TEMP_SENSOR_BED != 0
955
-      void watch_temp_callback_bed() {}
956
-    #endif
949
+  #if WATCH_THE_BED
950
+    void watch_temp_callback_bed() { thermalManager.start_watching_bed(); }
957 951
   #endif
958 952
 
959 953
   #if ENABLED(FILAMENT_CHANGE_FEATURE)
@@ -1021,7 +1015,7 @@ void kill_screen(const char* lcd_msg) {
1021 1015
     //
1022 1016
     // Bed:
1023 1017
     //
1024
-    #if TEMP_SENSOR_BED != 0
1018
+    #if WATCH_THE_BED
1025 1019
       MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
1026 1020
     #endif
1027 1021
 
@@ -2180,7 +2174,7 @@ void kill_screen(const char* lcd_msg) {
2180 2174
     //
2181 2175
     // Bed:
2182 2176
     //
2183
-    #if TEMP_SENSOR_BED != 0
2177
+    #if WATCH_THE_BED
2184 2178
       MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
2185 2179
     #endif
2186 2180
 

Loading…
Annulla
Salva