Przeglądaj źródła

Variable tool change purge (#14618)

InsanityAutomation 5 lat temu
rodzic
commit
ce02c6cee2

+ 16
- 3
Marlin/src/gcode/config/M217.cpp Wyświetl plik

@@ -32,6 +32,7 @@ void M217_report(const bool eeprom=false) {
32 32
   #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
33 33
     serialprintPGM(eeprom ? PSTR("  M217") : PSTR("Toolchange:"));
34 34
     SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
35
+    SERIAL_ECHOPAIR(" E", LINEAR_UNIT(toolchange_settings.extra_prime));
35 36
     SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed));
36 37
     SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed));
37 38
 
@@ -54,6 +55,7 @@ void M217_report(const bool eeprom=false) {
54 55
  * M217 - Set SINGLENOZZLE toolchange parameters
55 56
  *
56 57
  *  S[linear]   Swap length
58
+ *  E[linear]   Purge length
57 59
  *  P[linear/m] Prime speed
58 60
  *  R[linear/m] Retract speed
59 61
  *  X[linear]   Park X (Requires TOOLCHANGE_PARK)
@@ -68,18 +70,29 @@ void GcodeSuite::M217() {
68 70
   #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
69 71
 
70 72
     #undef SPR_PARAM
71
-    #define SPR_PARAM "SPR"
72
-
73
-    if (parser.seenval('S')) { const float v = parser.value_linear_units(); toolchange_settings.swap_length = constrain(v, 0, 500); }
73
+    #define SPR_PARAM "SPRE"
74
+
75
+    static constexpr float max_extrude =
76
+      #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
77
+        EXTRUDE_MAXLENGTH
78
+      #else
79
+        500
80
+      #endif
81
+    ;
82
+
83
+    if (parser.seenval('S')) { const float v = parser.value_linear_units(); toolchange_settings.swap_length = constrain(v, 0, max_extrude); }
84
+    if (parser.seenval('E')) { const float v = parser.value_linear_units(); toolchange_settings.extra_prime = constrain(v, 0, max_extrude); }
74 85
     if (parser.seenval('P')) { const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); }
75 86
     if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
76 87
   #endif
88
+
77 89
   #if ENABLED(TOOLCHANGE_PARK)
78 90
     #undef XY_PARAM
79 91
     #define XY_PARAM "XY"
80 92
     if (parser.seenval('X')) { toolchange_settings.change_point.x = parser.value_linear_units(); }
81 93
     if (parser.seenval('Y')) { toolchange_settings.change_point.y = parser.value_linear_units(); }
82 94
   #endif
95
+
83 96
   if (parser.seenval('Z')) { toolchange_settings.z_raise = parser.value_linear_units(); }
84 97
 
85 98
   if (!parser.seen(SPR_PARAM XY_PARAM "Z")) M217_report();

+ 6
- 3
Marlin/src/lcd/language/language_en.h Wyświetl plik

@@ -868,13 +868,16 @@
868 868
   #define MSG_AUTORETRACT                     _UxGT("AutoRetr.")
869 869
 #endif
870 870
 #ifndef MSG_FILAMENT_SWAP_LENGTH
871
-  #define MSG_FILAMENT_SWAP_LENGTH            _UxGT("Retract Distance")
871
+  #define MSG_FILAMENT_SWAP_LENGTH            _UxGT("Swap Length")
872
+#endif
873
+#ifndef MSG_FILAMENT_PURGE_LENGTH
874
+  #define MSG_FILAMENT_PURGE_LENGTH           _UxGT("Purge Length")
872 875
 #endif
873 876
 #ifndef MSG_TOOL_CHANGE
874
-  #define MSG_TOOL_CHANGE                      _UxGT("Tool Change")
877
+  #define MSG_TOOL_CHANGE                     _UxGT("Tool Change")
875 878
 #endif
876 879
 #ifndef MSG_TOOL_CHANGE_ZLIFT
877
-  #define MSG_TOOL_CHANGE_ZLIFT                _UxGT("Z Raise")
880
+  #define MSG_TOOL_CHANGE_ZLIFT               _UxGT("Z Raise")
878 881
 #endif
879 882
 #ifndef MSG_SINGLENOZZLE_PRIME_SPD
880 883
   #define MSG_SINGLENOZZLE_PRIME_SPD          _UxGT("Prime Speed")

+ 9
- 1
Marlin/src/lcd/menu/menu_configuration.cpp Wyświetl plik

@@ -109,7 +109,15 @@ static void lcd_factory_settings() {
109 109
     START_MENU();
110 110
     MENU_BACK(MSG_CONFIGURATION);
111 111
     #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
112
-      MENU_ITEM_EDIT(float3, MSG_FILAMENT_SWAP_LENGTH, &toolchange_settings.swap_length, 0, 200);
112
+      static constexpr float max_extrude =
113
+        #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
114
+          EXTRUDE_MAXLENGTH
115
+        #else
116
+          500
117
+        #endif
118
+      ;
119
+      MENU_ITEM_EDIT(float3, MSG_FILAMENT_SWAP_LENGTH, &toolchange_settings.swap_length, 0, max_extrude);
120
+      MENU_ITEM_EDIT(float3, MSG_FILAMENT_PURGE_LENGTH, &toolchange_settings.extra_prime, 0, max_extrude);
113 121
       MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_RETRACT_SPD, &toolchange_settings.retract_speed, 10, 5400);
114 122
       MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_PRIME_SPD, &toolchange_settings.prime_speed, 10, 5400);
115 123
     #endif

+ 2
- 1
Marlin/src/module/configuration_store.cpp Wyświetl plik

@@ -37,7 +37,7 @@
37 37
  */
38 38
 
39 39
 // Change EEPROM version if the structure changes
40
-#define EEPROM_VERSION "V67"
40
+#define EEPROM_VERSION "V68"
41 41
 #define EEPROM_OFFSET 100
42 42
 
43 43
 // Check the integrity of data offsets.
@@ -2290,6 +2290,7 @@ void MarlinSettings::reset() {
2290 2290
   #if EXTRUDERS > 1
2291 2291
     #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
2292 2292
       toolchange_settings.swap_length = TOOLCHANGE_FIL_SWAP_LENGTH;
2293
+      toolchange_settings.extra_prime = TOOLCHANGE_FIL_EXTRA_PRIME;
2293 2294
       toolchange_settings.prime_speed = TOOLCHANGE_FIL_SWAP_PRIME_SPEED;
2294 2295
       toolchange_settings.retract_speed = TOOLCHANGE_FIL_SWAP_RETRACT_SPEED;
2295 2296
     #endif

+ 3
- 6
Marlin/src/module/tool_change.cpp Wyświetl plik

@@ -993,16 +993,13 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
993 993
         #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
994 994
           if (should_swap && !too_cold) {
995 995
             #if ENABLED(ADVANCED_PAUSE_FEATURE)
996
-              do_pause_e_move(toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME, MMM_TO_MMS(toolchange_settings.prime_speed));
996
+              do_pause_e_move(toolchange_settings.swap_length + toolchange_settings.extra_prime, MMM_TO_MMS(toolchange_settings.prime_speed));
997 997
             #else
998
-              current_position[E_AXIS] += (toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME) / planner.e_factor[tmp_extruder];
998
+              current_position[E_AXIS] += (toolchange_settings.swap_length + toolchange_settings.extra_prime) / planner.e_factor[tmp_extruder];
999 999
               planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), tmp_extruder);
1000 1000
             #endif
1001 1001
             planner.synchronize();
1002
-
1003
-            #if TOOLCHANGE_FIL_EXTRA_PRIME
1004
-              planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = current_position[E_AXIS] - (TOOLCHANGE_FIL_EXTRA_PRIME)));
1005
-            #endif
1002
+            planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = current_position[E_AXIS] - (TOOLCHANGE_FIL_EXTRA_PRIME)));
1006 1003
           }
1007 1004
         #endif
1008 1005
 

+ 1
- 1
Marlin/src/module/tool_change.h Wyświetl plik

@@ -27,7 +27,7 @@
27 27
 
28 28
   typedef struct {
29 29
     #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
30
-      float swap_length;
30
+      float swap_length, extra_prime;
31 31
       int16_t prime_speed, retract_speed;
32 32
     #endif
33 33
     #if ENABLED(TOOLCHANGE_PARK)

Ładowanie…
Anuluj
Zapisz