Browse Source

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

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

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

29
 
29
 
30
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
30
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
31
 
31
 
32
+//#define DEBUG_PAUSE_RESUME
33
+
32
 #include "../MarlinCore.h"
34
 #include "../MarlinCore.h"
33
 #include "../gcode/gcode.h"
35
 #include "../gcode/gcode.h"
34
 #include "../module/motion.h"
36
 #include "../module/motion.h"
62
 #include "../libs/nozzle.h"
64
 #include "../libs/nozzle.h"
63
 #include "pause.h"
65
 #include "pause.h"
64
 
66
 
67
+#define DEBUG_OUT ENABLED(DEBUG_PAUSE_RESUME)
68
+#include "../core/debug_out.h"
69
+
65
 // private:
70
 // private:
66
 
71
 
67
 static xyze_pos_t resume_position;
72
 static xyze_pos_t resume_position;
120
  * Returns 'true' if heating was completed, 'false' for abort
125
  * Returns 'true' if heating was completed, 'false' for abort
121
  */
126
  */
122
 static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=PAUSE_MODE_SAME) {
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
   #if HAS_LCD_MENU
134
   #if HAS_LCD_MENU
132
     lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode);
135
     lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode);
133
-  #else
134
-    UNUSED(mode);
135
   #endif
136
   #endif
137
+  UNUSED(mode);
136
 
138
 
137
   if (wait)
139
   if (wait)
138
     return thermalManager.wait_for_hotend(active_extruder);
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
     idle();
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
   return true;
155
   return true;
144
 }
156
 }
160
                    const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
172
                    const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
161
                    DXC_ARGS
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
   if (!ensure_safe_temperature(false, mode)) {
180
   if (!ensure_safe_temperature(false, mode)) {
166
     #if HAS_LCD_MENU
181
     #if HAS_LCD_MENU
292
                        , const float &mix_multiplier/*=1.0*/
307
                        , const float &mix_multiplier/*=1.0*/
293
                      #endif
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
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
319
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
298
     constexpr float mix_multiplier = 1.0;
320
     constexpr float mix_multiplier = 1.0;
358
 uint8_t did_pause_print = 0;
380
 uint8_t did_pause_print = 0;
359
 
381
 
360
 bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
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
   if (did_pause_print) return false; // already paused
388
   if (did_pause_print) return false; // already paused
364
 
389
 
449
  */
474
  */
450
 
475
 
451
 void show_continue_prompt(const bool is_reload) {
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
   TERN_(HAS_LCD_MENU, lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING));
480
   TERN_(HAS_LCD_MENU, lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING));
453
   SERIAL_ECHO_START();
481
   SERIAL_ECHO_START();
454
   serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
482
   serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
455
 }
483
 }
456
 
484
 
457
 void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
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
   bool nozzle_timed_out = false;
489
   bool nozzle_timed_out = false;
459
 
490
 
460
   show_continue_prompt(is_reload);
491
   show_continue_prompt(is_reload);
551
  * - Resume the current SD print job, if any
582
  * - Resume the current SD print job, if any
552
  */
583
  */
553
 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) {
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
   SERIAL_ECHOLNPAIR(
589
   SERIAL_ECHOLNPAIR(
556
     "start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode,
590
     "start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode,

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

77
   #define DXC_PARAMS , const int8_t DXC_ext=-1
77
   #define DXC_PARAMS , const int8_t DXC_ext=-1
78
   #define DXC_ARGS   , const int8_t DXC_ext
78
   #define DXC_ARGS   , const int8_t DXC_ext
79
   #define DXC_PASS   , DXC_ext
79
   #define DXC_PASS   , DXC_ext
80
+  #define DXC_SAY    , " dxc:", int(DXC_ext)
80
 #else
81
 #else
81
   #define DXC_PARAMS
82
   #define DXC_PARAMS
82
   #define DXC_ARGS
83
   #define DXC_ARGS
83
   #define DXC_PASS
84
   #define DXC_PASS
85
+  #define DXC_SAY
84
 #endif
86
 #endif
85
 
87
 
86
 bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS);
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
   #include "../../../feature/mixing.h"
45
   #include "../../../feature/mixing.h"
46
 #endif
46
 #endif
47
 
47
 
48
+#if HAS_FILAMENT_SENSOR
49
+  #include "../../../feature/runout.h"
50
+#endif
51
+
48
 /**
52
 /**
49
  * M600: Pause for filament change
53
  * M600: Pause for filament change
50
  *
54
  *
158
                    beep_count, (parser.seenval('R') ? parser.value_celsius() : 0) DXC_PASS);
162
                    beep_count, (parser.seenval('R') ? parser.value_celsius() : 0) DXC_PASS);
159
     #endif
163
     #endif
160
   }
164
   }
165
+  else {
166
+    TERN_(HAS_FILAMENT_SENSOR, runout.reset());
167
+  }
161
 
168
 
162
   #if EXTRUDERS > 1
169
   #if EXTRUDERS > 1
163
     // Restore toolhead if it was changed
170
     // Restore toolhead if it was changed

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

330
     #if ENABLED(PREVENT_COLD_EXTRUSION)
330
     #if ENABLED(PREVENT_COLD_EXTRUSION)
331
       static bool allow_cold_extrude;
331
       static bool allow_cold_extrude;
332
       static int16_t extrude_min_temp;
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
       FORCE_INLINE static bool tooColdToExtrude(const uint8_t E_NAME) {
334
       FORCE_INLINE static bool tooColdToExtrude(const uint8_t E_NAME) {
335
         return tooCold(degHotend(HOTEND_INDEX));
335
         return tooCold(degHotend(HOTEND_INDEX));
336
       }
336
       }

Loading…
Cancel
Save