Browse Source

PFW-1386 Use Marlin 2 unload sequence for single material

The current unload sequence does not give good results.
The Marlin 2 sequence looks good on my end. This can be later
used to improve M600

Added all the constants from Marlin 2
Guðni Már Gilbert 2 years ago
parent
commit
0a90c7ffda
2 changed files with 71 additions and 1 deletions
  1. 56 0
      Firmware/Configuration_adv.h
  2. 15 1
      Firmware/ultralcd.cpp

+ 56 - 0
Firmware/Configuration_adv.h

@@ -346,6 +346,62 @@ const unsigned int dropsegments=5; //everything with less than this number of st
 // 2nd and 3rd byte (LSB first) contains a 16bit length of a command including its preceding comments.
 #define CMDHDRSIZE 3
 
+/**
+ * Advanced Pause for Filament Change
+ *  - Adds the G-code M600 Filament Change to initiate a filament change.
+ *  - This feature is required for the default FILAMENT_RUNOUT_SCRIPT.
+ *
+ * Requirements:
+ *  - For Filament Change parking enable and configure NOZZLE_PARK_FEATURE.
+ *  - For user interaction enable an LCD display, HOST_PROMPT_SUPPORT, or EMERGENCY_PARSER.
+ *
+ * Enable PARK_HEAD_ON_PAUSE to add the G-code M125 Pause and Park.
+ */
+
+#define PAUSE_PARK_RETRACT_FEEDRATE         60  // (mm/s) Initial retract feedrate.
+#define PAUSE_PARK_RETRACT_LENGTH            2  // (mm) Initial retract.
+                                                // This short retract is done immediately, before parking the nozzle.
+#define FILAMENT_CHANGE_UNLOAD_FEEDRATE     10  // (mm/s) Unload filament feedrate. This can be pretty fast.
+#define FILAMENT_CHANGE_UNLOAD_ACCEL        25  // (mm/s^2) Lower acceleration may allow a faster feedrate.
+#define FILAMENT_CHANGE_UNLOAD_LENGTH      100  // (mm) The length of filament for a complete unload.
+                                                //   For Bowden, the full length of the tube and nozzle.
+                                                //   For direct drive, the full length of the nozzle.
+                                                //   Set to 0 for manual unloading.
+#define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE   6  // (mm/s) Slow move when starting load.
+#define FILAMENT_CHANGE_SLOW_LOAD_LENGTH     0  // (mm) Slow length, to allow time to insert material.
+                                                // 0 to disable start loading and skip to fast load only
+#define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE   6  // (mm/s) Load filament feedrate. This can be pretty fast.
+#define FILAMENT_CHANGE_FAST_LOAD_ACCEL     25  // (mm/s^2) Lower acceleration may allow a faster feedrate.
+#define FILAMENT_CHANGE_FAST_LOAD_LENGTH     0  // (mm) Load length of filament, from extruder gear to nozzle.
+                                                //   For Bowden, the full length of the tube and nozzle.
+                                                //   For direct drive, the full length of the nozzle.
+//#define ADVANCED_PAUSE_CONTINUOUS_PURGE       // Purge continuously up to the purge length until interrupted.
+#define ADVANCED_PAUSE_PURGE_FEEDRATE        3  // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate.
+#define ADVANCED_PAUSE_PURGE_LENGTH         50  // (mm) Length to extrude after loading.
+                                                //   Set to 0 for manual extrusion.
+                                                //   Filament can be extruded repeatedly from the Filament Change menu
+                                                //   until extrusion is consistent, and to purge old filament.
+#define ADVANCED_PAUSE_RESUME_PRIME          0  // (mm) Extra distance to prime nozzle after returning from park.
+//#define ADVANCED_PAUSE_FANS_PAUSE             // Turn off print-cooling fans while the machine is paused.
+
+                                                // Filament Unload does a Retract, Delay, and Purge first:
+#define FILAMENT_UNLOAD_PURGE_RETRACT       13  // (mm) Unload initial retract length.
+#define FILAMENT_UNLOAD_PURGE_DELAY       5000  // (ms) Delay for the filament to cool after retract.
+#define FILAMENT_UNLOAD_PURGE_LENGTH         8  // (mm) An unretract is done, then this length is purged.
+#define FILAMENT_UNLOAD_PURGE_FEEDRATE      25  // (mm/s) feedrate to purge before unload
+
+#define PAUSE_PARK_NOZZLE_TIMEOUT           45  // (seconds) Time limit before the nozzle is turned off for safety.
+#define FILAMENT_CHANGE_ALERT_BEEPS         10  // Number of alert beeps to play when a response is needed.
+#define PAUSE_PARK_NO_STEPPER_TIMEOUT           // Enable for XYZ steppers to stay powered on during filament change.
+//#define FILAMENT_CHANGE_RESUME_ON_INSERT      // Automatically continue / load filament when runout sensor is triggered again.
+//#define PAUSE_REHEAT_FAST_RESUME              // Reduce number of waits by not prompting again post-timeout before continuing.
+
+//#define PARK_HEAD_ON_PAUSE                    // Park the nozzle during pause and filament change.
+//#define HOME_BEFORE_FILAMENT_CHANGE           // If needed, home before parking for filament change
+
+//#define FILAMENT_LOAD_UNLOAD_GCODES           // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
+//#define FILAMENT_UNLOAD_ALL_EXTRUDERS         // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
+
 
 // Firmware based and LCD controlled retract
 // M207 and M208 can be used to define parameters for the retraction.

+ 15 - 1
Firmware/ultralcd.cpp

@@ -5262,8 +5262,22 @@ void unload_filament(float unloadLength, bool automatic)
         raise_z_above(MIN_Z_FOR_SWAP);
     }
 
+    // Retract filament
+    current_position[E_AXIS] += -FILAMENT_UNLOAD_PURGE_RETRACT;
+    plan_buffer_line_curposXYZE(PAUSE_PARK_RETRACT_FEEDRATE);
+    st_synchronize();
+
+    // Wait for filament to cool
+    delay_keep_alive(FILAMENT_UNLOAD_PURGE_DELAY);
+
+    // Quickly purge
+    current_position[E_AXIS] += (FILAMENT_UNLOAD_PURGE_RETRACT + FILAMENT_UNLOAD_PURGE_LENGTH);
+    plan_buffer_line_curposXYZE(FILAMENT_UNLOAD_PURGE_FEEDRATE);
+    st_synchronize();
+
+    // Configurable length
     current_position[E_AXIS] += unloadLength;
-    plan_buffer_line_curposXYZE(1000 / 60);
+    plan_buffer_line_curposXYZE(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
     st_synchronize();
 
 	lcd_display_message_fullscreen_P(_T(MSG_PULL_OUT_FILAMENT));