Преглед изворни кода

Merge pull request #9290 from thinkyhead/bf2_print_start_fix

[2.0.x] Minor filament change improvements
Scott Lahteine пре 7 година
родитељ
комит
a19656e7cb
No account linked to committer's email address

+ 4
- 1
Marlin/src/Marlin.cpp Прегледај датотеку

@@ -336,7 +336,10 @@ void disable_all_steppers() {
336 336
 void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
337 337
 
338 338
   #if ENABLED(FILAMENT_RUNOUT_SENSOR)
339
-    if ((IS_SD_PRINTING || print_job_timer.isRunning()) && (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING))
339
+    if ((IS_SD_PRINTING || print_job_timer.isRunning())
340
+      && READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING
341
+      && thermalManager.targetHotEnoughToExtrude(active_extruder)
342
+    )
340 343
       handle_filament_runout();
341 344
   #endif
342 345
 

+ 86
- 16
Marlin/src/feature/pause.cpp Прегледај датотеку

@@ -83,6 +83,15 @@ float filament_change_unload_length[EXTRUDERS],
83 83
   }
84 84
 #endif
85 85
 
86
+/**
87
+ * Ensure a safe temperature for extrusion
88
+ *
89
+ * - Fail if the TARGET temperature is too low
90
+ * - Display LCD placard with temperature status
91
+ * - Return when heating is done or aborted
92
+ *
93
+ * Returns 'true' if heating was completed, 'false' for abort
94
+ */
86 95
 static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT) {
87 96
 
88 97
   #if ENABLED(PREVENT_COLD_EXTRUSION)
@@ -115,7 +124,19 @@ static void do_pause_e_move(const float &length, const float &fr) {
115 124
   set_current_from_destination();
116 125
 }
117 126
 
118
-bool load_filament(const float &load_length/*=0*/, const float &extrude_length/*=0*/, const int8_t max_beep_count/*=0*/,
127
+/**
128
+ * Load filament into the hotend
129
+ *
130
+ * - Fail if the a safe temperature was not reached
131
+ * - If pausing for confirmation, wait for a click or M108
132
+ * - Show "wait for load" placard
133
+ * - Load and purge filament
134
+ * - Show "Purge more" / "Continue" menu
135
+ * - Return when "Continue" is selected
136
+ *
137
+ * Returns 'true' if load was completed, 'false' for abort
138
+ */
139
+bool load_filament(const float &load_length/*=0*/, const float &purge_length/*=0*/, const int8_t max_beep_count/*=0*/,
119 140
                           const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/,
120 141
                           const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
121 142
 ) {
@@ -158,15 +179,15 @@ bool load_filament(const float &load_length/*=0*/, const float &extrude_length/*
158 179
   }
159 180
 
160 181
   #if ENABLED(ULTIPANEL)
161
-    if (show_lcd) // Show "load" message
182
+    if (show_lcd) // Show "wait for load" message
162 183
       lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode);
163 184
   #endif
164 185
 
165 186
   // Load filament
166
-  do_pause_e_move(load_length, FILAMENT_CHANGE_LOAD_FEEDRATE);
187
+  if (load_length) do_pause_e_move(load_length, FILAMENT_CHANGE_LOAD_FEEDRATE);
167 188
 
168 189
   do {
169
-    if (extrude_length > 0) {
190
+    if (purge_length > 0) {
170 191
       // "Wait for filament purge"
171 192
       #if ENABLED(ULTIPANEL)
172 193
         if (show_lcd)
@@ -174,10 +195,10 @@ bool load_filament(const float &load_length/*=0*/, const float &extrude_length/*
174 195
       #endif
175 196
 
176 197
       // Extrude filament to get into hotend
177
-      do_pause_e_move(extrude_length, ADVANCED_PAUSE_EXTRUDE_FEEDRATE);
198
+      do_pause_e_move(purge_length, ADVANCED_PAUSE_EXTRUDE_FEEDRATE);
178 199
     }
179 200
 
180
-    // Show "Extrude More" / "Resume" menu and wait for reply
201
+    // Show "Purge More" / "Resume" menu and wait for reply
181 202
     #if ENABLED(ULTIPANEL)
182 203
       if (show_lcd) {
183 204
         KEEPALIVE_STATE(PAUSED_FOR_USER);
@@ -188,7 +209,7 @@ bool load_filament(const float &load_length/*=0*/, const float &extrude_length/*
188 209
       }
189 210
     #endif
190 211
 
191
-    // Keep looping if "Extrude More" was selected
212
+    // Keep looping if "Purge More" was selected
192 213
   } while (
193 214
     #if ENABLED(ULTIPANEL)
194 215
       show_lcd && advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE
@@ -200,6 +221,16 @@ bool load_filament(const float &load_length/*=0*/, const float &extrude_length/*
200 221
   return true;
201 222
 }
202 223
 
224
+/**
225
+ * Unload filament from the hotend
226
+ *
227
+ * - Fail if the a safe temperature was not reached
228
+ * - Show "wait for unload" placard
229
+ * - Retract, pause, then unload filament
230
+ * - Disable E stepper (on most machines)
231
+ *
232
+ * Returns 'true' if unload was completed, 'false' for abort
233
+ */
203 234
 bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
204 235
                             const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
205 236
 ) {
@@ -242,6 +273,19 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
242 273
 
243 274
 // public:
244 275
 
276
+/**
277
+ * Pause procedure
278
+ *
279
+ * - Abort if already paused
280
+ * - Send host action for pause, if configured
281
+ * - Abort if TARGET temperature is too low
282
+ * - Display "wait for start of filament change" (if a length was specified)
283
+ * - Initial retract, if current temperature is hot enough
284
+ * - Park the nozzle at the given position
285
+ * - Call unload_filament (if a length was specified)
286
+ *
287
+ * Returns 'true' if pause was completed, 'false' for abort
288
+ */
245 289
 uint8_t did_pause_print = 0;
246 290
 
247 291
 bool pause_print(const float &retract, const point_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/) {
@@ -261,8 +305,10 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
261 305
     SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD);
262 306
 
263 307
     #if ENABLED(ULTIPANEL)
264
-      if (show_lcd) // Show status screen
308
+      if (show_lcd) { // Show status screen
265 309
         lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
310
+        LCD_MESSAGEPGM(MSG_M600_TOO_COLD);
311
+      }
266 312
     #endif
267 313
 
268 314
     return false; // unable to reach safe temperature
@@ -275,7 +321,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
275 321
   #if ENABLED(SDSUPPORT)
276 322
     if (card.sdprinting) {
277 323
       card.pauseSDPrint();
278
-      ++did_pause_print;
324
+      ++did_pause_print; // Indicate SD pause also
279 325
     }
280 326
   #endif
281 327
   print_job_timer.pause();
@@ -287,7 +333,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
287 333
   COPY(resume_position, current_position);
288 334
 
289 335
   // Initial retract before move to filament change position
290
-  if (retract && !thermalManager.tooColdToExtrude(active_extruder))
336
+  if (retract && thermalManager.hotEnoughToExtrude(active_extruder))
291 337
     do_pause_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
292 338
 
293 339
   // Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos)
@@ -300,6 +346,13 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
300 346
   return true;
301 347
 }
302 348
 
349
+/**
350
+ * - Show "Insert filament and press button to continue"
351
+ * - Wait for a click before returning
352
+ * - Heaters can time out, reheated before accepting a click
353
+ *
354
+ * Used by M125 and M600
355
+ */
303 356
 void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) {
304 357
   bool nozzle_timed_out = false;
305 358
 
@@ -386,20 +439,37 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) {
386 439
   KEEPALIVE_STATE(IN_HANDLER);
387 440
 }
388 441
 
389
-void resume_print(const float &load_length/*=0*/, const float &extrude_length/*=ADVANCED_PAUSE_EXTRUDE_LENGTH*/, const int8_t max_beep_count/*=0*/) {
390
-  bool nozzle_timed_out = false;
391
-
442
+/**
443
+ * Resume or Start print procedure
444
+ *
445
+ * - Abort if not paused
446
+ * - Reset heater idle timers
447
+ * - Load filament if specified, but only if:
448
+ *   - a nozzle timed out, or
449
+ *   - the nozzle is already heated.
450
+ * - Display "wait for print to resume"
451
+ * - Re-prime the nozzle...
452
+ *   -  FWRETRACT: Recover/prime from the prior G10.
453
+ *   - !FWRETRACT: Retract by resume_position[E], if negative.
454
+ *                 Not sure how this logic comes into use.
455
+ * - Move the nozzle back to resume_position
456
+ * - Sync the planner E to resume_position[E]
457
+ * - Send host action for resume, if configured
458
+ * - Resume the current SD print job, if any
459
+ */
460
+void resume_print(const float &load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_EXTRUDE_LENGTH*/, const int8_t max_beep_count/*=0*/) {
392 461
   if (!did_pause_print) return;
393 462
 
394 463
   // Re-enable the heaters if they timed out
464
+  bool nozzle_timed_out = false;
395 465
   HOTEND_LOOP() {
396 466
     nozzle_timed_out |= thermalManager.is_heater_idle(e);
397 467
     thermalManager.reset_heater_idle_timer(e);
398 468
   }
399 469
 
400
-  if (nozzle_timed_out || !thermalManager.tooColdToExtrude(active_extruder)) {
470
+  if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) {
401 471
     // Load the new filament
402
-    load_filament(load_length, extrude_length, max_beep_count, true, nozzle_timed_out);
472
+    load_filament(load_length, purge_length, max_beep_count, true, nozzle_timed_out);
403 473
   }
404 474
 
405 475
   #if ENABLED(ULTIPANEL)
@@ -413,7 +483,7 @@ void resume_print(const float &load_length/*=0*/, const float &extrude_length/*=
413 483
     if (fwretract.retracted[active_extruder])
414 484
       do_pause_e_move(-fwretract.retract_length, fwretract.retract_feedrate_mm_s);
415 485
   #else
416
-    // If resume_position negative
486
+    // If resume_position is negative
417 487
     if (resume_position[E_AXIS] < 0) do_pause_e_move(resume_position[E_AXIS], PAUSE_PARK_RETRACT_FEEDRATE);
418 488
   #endif
419 489
 

+ 3
- 3
Marlin/src/gcode/feature/pause/M125.cpp Прегледај датотеку

@@ -50,11 +50,11 @@
50 50
  */
51 51
 void GcodeSuite::M125() {
52 52
   // Initial retract before move to filament change position
53
-  const float retract = parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
53
+  const float retract = -FABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
54 54
     #ifdef PAUSE_PARK_RETRACT_LENGTH
55
-      - (PAUSE_PARK_RETRACT_LENGTH)
55
+      + (PAUSE_PARK_RETRACT_LENGTH)
56 56
     #endif
57
-  ;
57
+  );
58 58
 
59 59
   point_t park_point = NOZZLE_PARK_POINT;
60 60
 

+ 1
- 1
Marlin/src/gcode/feature/pause/M600.cpp Прегледај датотеку

@@ -56,7 +56,7 @@ void GcodeSuite::M600() {
56 56
 
57 57
   if (get_target_extruder_from_command()) return;
58 58
 
59
-  // Show initial message
59
+  // Show initial "wait for start" message
60 60
   #if ENABLED(ULTIPANEL)
61 61
     lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, target_extruder);
62 62
   #endif

+ 2
- 2
Marlin/src/gcode/feature/pause/M701_M702.cpp Прегледај датотеку

@@ -59,7 +59,7 @@ void GcodeSuite::M701() {
59 59
   const float load_length = FABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) :
60 60
                                                     filament_change_load_length[target_extruder]);
61 61
 
62
-  // Show initial message
62
+  // Show initial "wait for load" message
63 63
   #if ENABLED(ULTIPANEL)
64 64
     lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, ADVANCED_PAUSE_MODE_LOAD_FILAMENT, target_extruder);
65 65
   #endif
@@ -112,7 +112,7 @@ void GcodeSuite::M702() {
112 112
   // Z axis lift
113 113
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
114 114
 
115
-  // Show initial message
115
+  // Show initial "wait for unload" message
116 116
   #if ENABLED(ULTIPANEL)
117 117
     lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, target_extruder);
118 118
   #endif

+ 3
- 0
Marlin/src/lcd/language/language_en.h Прегледај датотеку

@@ -959,6 +959,9 @@
959 959
 #ifndef MSG_ERR_PROBING_FAILED
960 960
   #define MSG_ERR_PROBING_FAILED              _UxGT("Probing failed")
961 961
 #endif
962
+#ifndef MSG_M600_TOO_COLD
963
+  #define MSG_M600_TOO_COLD                   _UxGT("M600: Too cold")
964
+#endif
962 965
 
963 966
 //
964 967
 // Filament Change screens show up to 3 lines on a 4-line display

+ 13
- 13
Marlin/src/lcd/ultralcd.cpp Прегледај датотеку

@@ -1402,7 +1402,7 @@ void kill_screen(const char* lcd_msg) {
1402 1402
     //
1403 1403
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
1404 1404
       #if E_STEPPERS == 1 && !ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
1405
-        if (!thermalManager.targetTooColdToExtrude(active_extruder))
1405
+        if (thermalManager.targetHotEnoughToExtrude(active_extruder))
1406 1406
           MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0"));
1407 1407
         else
1408 1408
           MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_temp_menu_e0_filament_change);
@@ -2608,7 +2608,7 @@ void kill_screen(const char* lcd_msg) {
2608 2608
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
2609 2609
       if (!IS_SD_FILE_OPEN) {
2610 2610
         #if E_STEPPERS == 1 && !ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
2611
-          if (!thermalManager.targetTooColdToExtrude(active_extruder))
2611
+          if (thermalManager.targetHotEnoughToExtrude(active_extruder))
2612 2612
             MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0"));
2613 2613
           else
2614 2614
             MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_temp_menu_e0_filament_change);
@@ -4282,21 +4282,21 @@ void kill_screen(const char* lcd_msg) {
4282 4282
 
4283 4283
             // Unload filament
4284 4284
             #if E_STEPPERS == 1
4285
-              if (!thermalManager.targetTooColdToExtrude(active_extruder))
4285
+              if (thermalManager.targetHotEnoughToExtrude(active_extruder))
4286 4286
                 MENU_ITEM(gcode, MSG_FILAMENTUNLOAD, PSTR("M702"));
4287 4287
               else
4288 4288
                 MENU_ITEM(submenu, MSG_FILAMENTUNLOAD, lcd_temp_menu_e0_filament_unload);
4289 4289
             #else
4290 4290
               #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
4291
-                if (!thermalManager.targetTooColdToExtrude(0)
4291
+                if (thermalManager.targetHotEnoughToExtrude(0)
4292 4292
                   #if E_STEPPERS > 1
4293
-                    && !thermalManager.targetTooColdToExtrude(1)
4293
+                    && thermalManager.targetHotEnoughToExtrude(1)
4294 4294
                     #if E_STEPPERS > 2
4295
-                      && !thermalManager.targetTooColdToExtrude(2)
4295
+                      && thermalManager.targetHotEnoughToExtrude(2)
4296 4296
                       #if E_STEPPERS > 3
4297
-                        && !thermalManager.targetTooColdToExtrude(3)
4297
+                        && thermalManager.targetHotEnoughToExtrude(3)
4298 4298
                         #if E_STEPPERS > 4
4299
-                          && !thermalManager.targetTooColdToExtrude(4)
4299
+                          && thermalManager.targetHotEnoughToExtrude(4)
4300 4300
                         #endif // E_STEPPERS > 4
4301 4301
                       #endif // E_STEPPERS > 3
4302 4302
                     #endif // E_STEPPERS > 2
@@ -4306,26 +4306,26 @@ void kill_screen(const char* lcd_msg) {
4306 4306
               else
4307 4307
                 MENU_ITEM(submenu, MSG_FILAMENTUNLOAD_ALL, lcd_unload_filament_all_temp_menu);
4308 4308
               #endif
4309
-              if (!thermalManager.targetTooColdToExtrude(0))
4309
+              if (thermalManager.targetHotEnoughToExtrude(0))
4310 4310
                 MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E1, PSTR("M702 T0"));
4311 4311
               else
4312 4312
                 MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E1, lcd_temp_menu_e0_filament_unload);
4313
-              if (!thermalManager.targetTooColdToExtrude(1))
4313
+              if (thermalManager.targetHotEnoughToExtrude(1))
4314 4314
                 MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E2, PSTR("M702 T1"));
4315 4315
               else
4316 4316
                 MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E2, lcd_temp_menu_e1_filament_unload);
4317 4317
               #if E_STEPPERS > 2
4318
-                if (!thermalManager.targetTooColdToExtrude(2))
4318
+                if (thermalManager.targetHotEnoughToExtrude(2))
4319 4319
                   MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E3, PSTR("M702 T2"));
4320 4320
                 else
4321 4321
                   MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E3, lcd_temp_menu_e2_filament_unload);
4322 4322
                 #if E_STEPPERS > 3
4323
-                  if (!thermalManager.targetTooColdToExtrude(3))
4323
+                  if (thermalManager.targetHotEnoughToExtrude(3))
4324 4324
                     MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E4, PSTR("M702 T3"));
4325 4325
                   else
4326 4326
                     MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E4, lcd_temp_menu_e3_filament_unload);
4327 4327
                   #if E_STEPPERS > 4
4328
-                    if (!thermalManager.targetTooColdToExtrude(4))
4328
+                    if (thermalManager.targetHotEnoughToExtrude(4))
4329 4329
                       MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E5, PSTR("M702 T4"));
4330 4330
                     else
4331 4331
                       MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E5, lcd_temp_menu_e4_filament_unload);

+ 3
- 0
Marlin/src/module/temperature.h Прегледај датотеку

@@ -188,6 +188,9 @@ class Temperature {
188 188
       FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) { UNUSED(e); return false; }
189 189
     #endif
190 190
 
191
+    FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
192
+    FORCE_INLINE static bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); }
193
+
191 194
   private:
192 195
 
193 196
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)

Loading…
Откажи
Сачувај