Browse Source

Make M600 heat up the nozzle. Reset runout on fail. (#19298)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Giuliano Zaro 3 years ago
parent
commit
828a582f4d
No account linked to committer's email address

+ 46
- 12
Marlin/src/feature/pause.cpp View File

@@ -29,6 +29,8 @@
29 29
 
30 30
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
31 31
 
32
+//#define DEBUG_PAUSE_RESUME
33
+
32 34
 #include "../MarlinCore.h"
33 35
 #include "../gcode/gcode.h"
34 36
 #include "../module/motion.h"
@@ -62,6 +64,9 @@
62 64
 #include "../libs/nozzle.h"
63 65
 #include "pause.h"
64 66
 
67
+#define DEBUG_OUT ENABLED(DEBUG_PAUSE_RESUME)
68
+#include "../core/debug_out.h"
69
+
65 70
 // private:
66 71
 
67 72
 static xyze_pos_t resume_position;
@@ -120,25 +125,32 @@ fil_change_settings_t fc_settings[EXTRUDERS];
120 125
  * Returns 'true' if heating was completed, 'false' for abort
121 126
  */
122 127
 static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=PAUSE_MODE_SAME) {
128
+  DEBUG_SECTION(est, "ensure_safe_temperature", true);
129
+  DEBUG_ECHOLNPAIR("... wait:", int(wait), " mode:", int(mode));
123 130
 
124
-  #if ENABLED(PREVENT_COLD_EXTRUSION)
125
-    if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
126
-      SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
127
-      return false;
128
-    }
129
-  #endif
131
+  if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder))
132
+    thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
130 133
 
131 134
   #if HAS_LCD_MENU
132 135
     lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode);
133
-  #else
134
-    UNUSED(mode);
135 136
   #endif
137
+  UNUSED(mode);
136 138
 
137 139
   if (wait)
138 140
     return thermalManager.wait_for_hotend(active_extruder);
139 141
 
140
-  while (ABS(thermalManager.degHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > TEMP_WINDOW)
142
+  wait_for_heatup = true; // Allow interruption by Emergency Parser M108
143
+  while (wait_for_heatup && ABS(thermalManager.degHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > TEMP_WINDOW)
141 144
     idle();
145
+  wait_for_heatup = false;
146
+
147
+  #if ENABLED(PREVENT_COLD_EXTRUSION)
148
+    // A user can cancel wait-for-heating with M108
149
+    if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
150
+      SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
151
+      return false;
152
+    }
153
+  #endif
142 154
 
143 155
   return true;
144 156
 }
@@ -160,7 +172,10 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
160 172
                    const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
161 173
                    DXC_ARGS
162 174
 ) {
163
-  TERN(HAS_LCD_MENU,,UNUSED(show_lcd));
175
+  DEBUG_SECTION(lf, "load_filament", true);
176
+  DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " showlcd:", int(show_lcd), " pauseforuser:", int(pause_for_user), " pausemode:", int(mode) DXC_SAY);
177
+
178
+  UNUSED(show_lcd);
164 179
 
165 180
   if (!ensure_safe_temperature(false, mode)) {
166 181
     #if HAS_LCD_MENU
@@ -292,7 +307,14 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
292 307
                        , const float &mix_multiplier/*=1.0*/
293 308
                      #endif
294 309
 ) {
295
-  TERN(HAS_LCD_MENU,,UNUSED(show_lcd));
310
+  DEBUG_SECTION(uf, "unload_filament", true);
311
+  DEBUG_ECHOLNPAIR("... unloadlen:", unload_length, " showlcd:", int(show_lcd), " mode:", int(mode)
312
+    #if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
313
+      , " mixmult:", mix_multiplier
314
+    #endif
315
+  );
316
+
317
+  UNUSED(show_lcd);
296 318
 
297 319
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
298 320
     constexpr float mix_multiplier = 1.0;
@@ -358,7 +380,10 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
358 380
 uint8_t did_pause_print = 0;
359 381
 
360 382
 bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
361
-  TERN(HAS_LCD_MENU,,UNUSED(show_lcd));
383
+  DEBUG_SECTION(pp, "pause_print", true);
384
+  DEBUG_ECHOLNPAIR("... retract:", retract, " park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", int(show_lcd) DXC_SAY);
385
+
386
+  UNUSED(show_lcd);
362 387
 
363 388
   if (did_pause_print) return false; // already paused
364 389
 
@@ -449,12 +474,18 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
449 474
  */
450 475
 
451 476
 void show_continue_prompt(const bool is_reload) {
477
+  DEBUG_SECTION(scp, "pause_print", true);
478
+  DEBUG_ECHOLNPAIR("... is_reload:", int(is_reload));
479
+
452 480
   TERN_(HAS_LCD_MENU, lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING));
453 481
   SERIAL_ECHO_START();
454 482
   serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
455 483
 }
456 484
 
457 485
 void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
486
+  DEBUG_SECTION(wfc, "wait_for_confirmation", true);
487
+  DEBUG_ECHOLNPAIR("... is_reload:", is_reload, " maxbeep:", int(max_beep_count) DXC_SAY);
488
+
458 489
   bool nozzle_timed_out = false;
459 490
 
460 491
   show_continue_prompt(is_reload);
@@ -551,6 +582,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
551 582
  * - Resume the current SD print job, if any
552 583
  */
553 584
 void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/, int16_t targetTemp/*=0*/ DXC_ARGS) {
585
+  DEBUG_SECTION(rp, "resume_print", true);
586
+  DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " targetTemp:", targetTemp DXC_SAY);
587
+
554 588
   /*
555 589
   SERIAL_ECHOLNPAIR(
556 590
     "start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode,

+ 2
- 0
Marlin/src/feature/pause.h View File

@@ -77,10 +77,12 @@ extern uint8_t did_pause_print;
77 77
   #define DXC_PARAMS , const int8_t DXC_ext=-1
78 78
   #define DXC_ARGS   , const int8_t DXC_ext
79 79
   #define DXC_PASS   , DXC_ext
80
+  #define DXC_SAY    , " dxc:", int(DXC_ext)
80 81
 #else
81 82
   #define DXC_PARAMS
82 83
   #define DXC_ARGS
83 84
   #define DXC_PASS
85
+  #define DXC_SAY
84 86
 #endif
85 87
 
86 88
 bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS);

+ 7
- 0
Marlin/src/gcode/feature/pause/M600.cpp View File

@@ -45,6 +45,10 @@
45 45
   #include "../../../feature/mixing.h"
46 46
 #endif
47 47
 
48
+#if HAS_FILAMENT_SENSOR
49
+  #include "../../../feature/runout.h"
50
+#endif
51
+
48 52
 /**
49 53
  * M600: Pause for filament change
50 54
  *
@@ -158,6 +162,9 @@ void GcodeSuite::M600() {
158 162
                    beep_count, (parser.seenval('R') ? parser.value_celsius() : 0) DXC_PASS);
159 163
     #endif
160 164
   }
165
+  else {
166
+    TERN_(HAS_FILAMENT_SENSOR, runout.reset());
167
+  }
161 168
 
162 169
   #if EXTRUDERS > 1
163 170
     // Restore toolhead if it was changed

+ 1
- 1
Marlin/src/module/temperature.h View File

@@ -330,7 +330,7 @@ class Temperature {
330 330
     #if ENABLED(PREVENT_COLD_EXTRUSION)
331 331
       static bool allow_cold_extrude;
332 332
       static int16_t extrude_min_temp;
333
-      FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; }
333
+      FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp - (TEMP_WINDOW); }
334 334
       FORCE_INLINE static bool tooColdToExtrude(const uint8_t E_NAME) {
335 335
         return tooCold(degHotend(HOTEND_INDEX));
336 336
       }

Loading…
Cancel
Save