Browse Source

Updates for ensure_safe_temperature (#6963)

* Updates for ensure_safe_temperature

* M600 fixes
Thomas Moore 7 years ago
parent
commit
897bc2ac1f
1 changed files with 33 additions and 43 deletions
  1. 33
    43
      Marlin/Marlin_main.cpp

+ 33
- 43
Marlin/Marlin_main.cpp View File

@@ -5871,15 +5871,41 @@ inline void gcode_M17() {
5871 5871
     }
5872 5872
   }
5873 5873
 
5874
+  static void ensure_safe_temperature() {
5875
+    bool heaters_heating = true;
5876
+
5877
+    wait_for_heatup = true;    // M108 will clear this
5878
+    while (wait_for_heatup && heaters_heating) {
5879
+      idle();
5880
+      heaters_heating = false;
5881
+      HOTEND_LOOP() {
5882
+        if (thermalManager.degTargetHotend(e) && abs(thermalManager.degHotend(e) - thermalManager.degTargetHotend(e)) > 3) {
5883
+          heaters_heating = true;
5884
+          #if ENABLED(ULTIPANEL)
5885
+            lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);
5886
+          #endif
5887
+          break;
5888
+        }
5889
+      }
5890
+    }
5891
+  }
5892
+
5874 5893
   static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos,
5875 5894
                           const float &unload_length = 0 , int8_t max_beep_count = 0, bool show_lcd = false
5876 5895
   ) {
5877 5896
     if (move_away_flag) return false; // already paused
5878 5897
 
5879
-    if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder) && unload_length > 0) {
5880
-      SERIAL_ERROR_START;
5881
-      SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600);
5882
-      return false;
5898
+    if (!DEBUGGING(DRYRUN) && unload_length != 0) {
5899
+      #if ENABLED(PREVENT_COLD_EXTRUSION)
5900
+        if (!thermalManager.allow_cold_extrude && 
5901
+            thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) {
5902
+          SERIAL_ERROR_START;
5903
+          SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600);
5904
+          return false;
5905
+        }
5906
+      #endif
5907
+
5908
+      ensure_safe_temperature(); // wait for extruder to heat up before unloading
5883 5909
     }
5884 5910
 
5885 5911
     // Indicate that the printer is paused
@@ -5965,25 +5991,6 @@ inline void gcode_M17() {
5965 5991
     return true;
5966 5992
   }
5967 5993
 
5968
-  static void ensure_safe_temperature() {
5969
-    bool did_show = false;
5970
-    wait_for_heatup = true;
5971
-    while (wait_for_heatup) {
5972
-      idle();
5973
-      wait_for_heatup = false;
5974
-      HOTEND_LOOP() {
5975
-        if (thermalManager.degTargetHotend(e) && abs(thermalManager.degHotend(e) - thermalManager.degTargetHotend(e)) > 3) {
5976
-          wait_for_heatup = true;
5977
-          if (!did_show) { // Show "wait for heating"
5978
-            lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);
5979
-            did_show = true;
5980
-          }
5981
-          break;
5982
-        }
5983
-      }
5984
-    }
5985
-  }
5986
-
5987 5994
   static void wait_for_filament_reload(int8_t max_beep_count = 0) {
5988 5995
     bool nozzle_timed_out = false;
5989 5996
 
@@ -6000,7 +6007,8 @@ inline void gcode_M17() {
6000 6007
           nozzle_timed_out |= thermalManager.is_heater_idle(e);
6001 6008
 
6002 6009
       #if ENABLED(ULTIPANEL)
6003
-        if (nozzle_timed_out) ensure_safe_temperature();
6010
+        if (nozzle_timed_out)
6011
+          lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
6004 6012
       #endif
6005 6013
 
6006 6014
       idle(true);
@@ -6019,23 +6027,7 @@ inline void gcode_M17() {
6019 6027
       thermalManager.reset_heater_idle_timer(e);
6020 6028
     }
6021 6029
 
6022
-    #if ENABLED(ULTIPANEL)
6023
-      // Show "wait for heating"
6024
-      lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);
6025
-    #endif
6026
-
6027
-    wait_for_heatup = true;
6028
-    while (wait_for_heatup) {
6029
-      idle();
6030
-      wait_for_heatup = false;
6031
-      HOTEND_LOOP() {
6032
-        const int16_t target_temp = thermalManager.degTargetHotend(e);
6033
-        if (target_temp && abs(thermalManager.degHotend(e) - target_temp) > 3) {
6034
-          wait_for_heatup = true;
6035
-          break;
6036
-        }
6037
-      }
6038
-    }
6030
+    if (nozzle_timed_out) ensure_safe_temperature();
6039 6031
 
6040 6032
     #if HAS_BUZZER
6041 6033
       filament_change_beep(max_beep_count, true);
@@ -9248,8 +9240,6 @@ inline void gcode_M503() {
9248 9240
    */
9249 9241
   inline void gcode_M600() {
9250 9242
 
9251
-    ensure_safe_temperature();
9252
-
9253 9243
     // Initial retract before move to filament change position
9254 9244
     const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
9255 9245
       #if defined(PAUSE_PARK_RETRACT_LENGTH) && PAUSE_PARK_RETRACT_LENGTH > 0

Loading…
Cancel
Save