Преглед на файлове

Implementation of FW extruder change retract

FW retraction is extended onto swap retraction invoked by 'G10 S1'.
Bookkeeping of the retract state of all extruders allows for having one
extruder fw standard retracted while another extruder is swap retracted.
An LCD menu item for the swap retract and recover length was added.
Dim3nsioneer преди 11 години
родител
ревизия
3c927901a4
променени са 5 файла, в които са добавени 103 реда и са изтрити 14 реда
  1. 2
    0
      Marlin/Configuration_adv.h
  2. 3
    3
      Marlin/Marlin.h
  3. 65
    10
      Marlin/Marlin_main.cpp
  4. 26
    0
      Marlin/language.h
  5. 7
    1
      Marlin/ultralcd.cpp

+ 2
- 0
Marlin/Configuration_adv.h Целия файл

@@ -410,9 +410,11 @@ const unsigned int dropsegments=5; //everything with less than this number of st
410 410
 #ifdef FWRETRACT
411 411
   #define MIN_RETRACT 0.1                //minimum extruded mm to accept a automatic gcode retraction attempt
412 412
   #define RETRACT_LENGTH 3               //default retract length (positive mm)
413
+  #define RETRACT_LENGTH_SWAP 13         //default swap retract length (positive mm), for extruder change
413 414
   #define RETRACT_FEEDRATE 45            //default feedrate for retracting (mm/s)
414 415
   #define RETRACT_ZLIFT 0                //default retract Z-lift
415 416
   #define RETRACT_RECOVER_LENGTH 0       //default additional recover length (mm, added to retract length when recovering)
417
+  #define RETRACT_RECOVER_LENGTH_SWAP 0  //default additional swap recover length (mm, added to retract length when recovering from extruder change)
416 418
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
417 419
 #endif
418 420
 

+ 3
- 3
Marlin/Marlin.h Целия файл

@@ -231,9 +231,9 @@ extern unsigned char fanSpeedSoftPwm;
231 231
 
232 232
 #ifdef FWRETRACT
233 233
 extern bool autoretract_enabled;
234
-extern bool retracted;
235
-extern float retract_length, retract_feedrate, retract_zlift;
236
-extern float retract_recover_length, retract_recover_feedrate;
234
+extern bool retracted[EXTRUDERS];
235
+extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift;
236
+extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
237 237
 #endif
238 238
 
239 239
 extern unsigned long starttime;

+ 65
- 10
Marlin/Marlin_main.cpp Целия файл

@@ -243,11 +243,29 @@ int EtoPPressure=0;
243 243
 
244 244
 #ifdef FWRETRACT
245 245
   bool autoretract_enabled=false;
246
-  bool retracted=false;
246
+  bool retracted[EXTRUDERS]={false
247
+    #if EXTRUDERS > 1
248
+    , false
249
+     #if EXTRUDERS > 2
250
+      , false
251
+     #endif
252
+  #endif
253
+  };
254
+  bool retracted_swap[EXTRUDERS]={false
255
+    #if EXTRUDERS > 1
256
+    , false
257
+     #if EXTRUDERS > 2
258
+      , false
259
+     #endif
260
+  #endif
261
+  };
262
+
247 263
   float retract_length = RETRACT_LENGTH;
264
+  float retract_length_swap = RETRACT_LENGTH_SWAP;
248 265
   float retract_feedrate = RETRACT_FEEDRATE;
249 266
   float retract_zlift = RETRACT_ZLIFT;
250 267
   float retract_recover_length = RETRACT_RECOVER_LENGTH;
268
+  float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
251 269
   float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
252 270
 #endif
253 271
 
@@ -1117,23 +1135,27 @@ void refresh_cmd_timeout(void)
1117 1135
 }
1118 1136
 
1119 1137
 #ifdef FWRETRACT
1120
-  void retract(bool retracting) {
1121
-    if(retracting && !retracted) {
1138
+  void retract(bool retracting, bool swapretract = false) {
1139
+    if(retracting && !retracted[active_extruder]) {
1122 1140
       destination[X_AXIS]=current_position[X_AXIS];
1123 1141
       destination[Y_AXIS]=current_position[Y_AXIS];
1124 1142
       destination[Z_AXIS]=current_position[Z_AXIS];
1125 1143
       destination[E_AXIS]=current_position[E_AXIS];
1126
-      current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
1144
+      if (swapretract) {
1145
+        current_position[E_AXIS]+=retract_length_swap/volumetric_multiplier[active_extruder];
1146
+      } else {
1147
+        current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
1148
+      }
1127 1149
       plan_set_e_position(current_position[E_AXIS]);
1128 1150
       float oldFeedrate = feedrate;
1129 1151
       feedrate=retract_feedrate*60;
1130
-      retracted=true;
1152
+      retracted[active_extruder]=true;
1131 1153
       prepare_move();
1132 1154
       current_position[Z_AXIS]-=retract_zlift;
1133 1155
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1134 1156
       prepare_move();
1135 1157
       feedrate = oldFeedrate;
1136
-    } else if(!retracting && retracted) {
1158
+    } else if(!retracting && retracted[active_extruder]) {
1137 1159
       destination[X_AXIS]=current_position[X_AXIS];
1138 1160
       destination[Y_AXIS]=current_position[Y_AXIS];
1139 1161
       destination[Z_AXIS]=current_position[Z_AXIS];
@@ -1141,11 +1163,15 @@ void refresh_cmd_timeout(void)
1141 1163
       current_position[Z_AXIS]+=retract_zlift;
1142 1164
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1143 1165
       //prepare_move();
1144
-      current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; 
1166
+      if (swapretract) {
1167
+        current_position[E_AXIS]-=(retract_length_swap+retract_recover_length_swap)/volumetric_multiplier[active_extruder]; 
1168
+      } else {
1169
+        current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; 
1170
+      }
1145 1171
       plan_set_e_position(current_position[E_AXIS]);
1146 1172
       float oldFeedrate = feedrate;
1147 1173
       feedrate=retract_recover_feedrate*60;
1148
-      retracted=false;
1174
+      retracted[active_extruder]=false;
1149 1175
       prepare_move();
1150 1176
       feedrate = oldFeedrate;
1151 1177
     }
@@ -1215,10 +1241,19 @@ void process_commands()
1215 1241
       break;
1216 1242
       #ifdef FWRETRACT
1217 1243
       case 10: // G10 retract
1244
+       #if EXTRUDERS > 1
1245
+        retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument
1246
+        retract(true,retracted_swap[active_extruder]);
1247
+       #else
1218 1248
         retract(true);
1249
+       #endif
1219 1250
       break;
1220 1251
       case 11: // G11 retract_recover
1252
+       #if EXTRUDERS > 1
1253
+        retract(false,retracted_swap[active_extruder]);
1254
+       #else
1221 1255
         retract(false);
1256
+       #endif 
1222 1257
       break;
1223 1258
       #endif //FWRETRACT
1224 1259
     case 28: //G28 Home all Axis one at a time
@@ -2391,8 +2426,28 @@ void process_commands()
2391 2426
         int t= code_value() ;
2392 2427
         switch(t)
2393 2428
         {
2394
-          case 0: autoretract_enabled=false;retracted=false;break;
2395
-          case 1: autoretract_enabled=true;retracted=false;break;
2429
+          case 0: 
2430
+          {
2431
+            autoretract_enabled=false;
2432
+            retracted[0]=false;
2433
+            #if EXTRUDERS > 1
2434
+              retracted[1]=false;
2435
+            #endif
2436
+            #if EXTRUDERS > 2
2437
+              retracted[2]=false;
2438
+            #endif
2439
+          }break;
2440
+          case 1: 
2441
+          {
2442
+            autoretract_enabled=true;
2443
+            retracted[0]=false;
2444
+            #if EXTRUDERS > 1
2445
+              retracted[1]=false;
2446
+            #endif
2447
+            #if EXTRUDERS > 2
2448
+              retracted[2]=false;
2449
+            #endif
2450
+          }break;
2396 2451
           default:
2397 2452
             SERIAL_ECHO_START;
2398 2453
             SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND);

+ 26
- 0
Marlin/language.h Целия файл

@@ -171,9 +171,11 @@
171 171
 	#define MSG_KILLED "KILLED. "
172 172
 	#define MSG_STOPPED "STOPPED. "
173 173
 	#define MSG_CONTROL_RETRACT  "Retract mm"
174
+	#define MSG_CONTROL_RETRACT_SWAP  "Swap Re.mm"
174 175
 	#define MSG_CONTROL_RETRACTF "Retract  V"
175 176
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
176 177
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
178
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "S UnRet+mm"
177 179
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
178 180
 	#define MSG_AUTORETRACT "AutoRetr."
179 181
 	#define MSG_FILAMENTCHANGE "Change filament"
@@ -371,9 +373,11 @@
371 373
 	#define MSG_STOPPED "Zatrzymany. "
372 374
 	#define MSG_STEPPER_RELEASED "Zwolniony."
373 375
 	#define MSG_CONTROL_RETRACT  "Wycofaj mm"
376
+	#define MSG_CONTROL_RETRACT_SWAP  "Z Wycof. mm"
374 377
 	#define MSG_CONTROL_RETRACTF "Wycofaj  V"
375 378
 	#define MSG_CONTROL_RETRACT_ZLIFT "Skok Z mm:"
376 379
 	#define MSG_CONTROL_RETRACT_RECOVER "Cof. wycof. +mm"
380
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Z Cof. wyc. +mm"
377 381
 	#define MSG_CONTROL_RETRACT_RECOVERF "Cof. wycof.  V"
378 382
 	#define MSG_AUTORETRACT "Auto. wycofanie"
379 383
 	#define MSG_FILAMENTCHANGE "Zmien filament"
@@ -572,9 +576,11 @@
572 576
 	#define MSG_STOPPED "STOPPE."
573 577
 	#define MSG_STEPPER_RELEASED "RELACHE."
574 578
 	#define MSG_CONTROL_RETRACT "Retraction mm"
579
+	#define MSG_CONTROL_RETRACT_SWAP "Ech. Retr. mm"
575 580
 	#define MSG_CONTROL_RETRACTF "Retraction V"
576 581
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
577 582
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
583
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Ech. UnRet +mm"
578 584
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet V"
579 585
 	#define MSG_AUTORETRACT "Retract. Auto."
580 586
 	#define MSG_FILAMENTCHANGE "Changer filament"
@@ -774,9 +780,11 @@
774 780
 	#define MSG_STOPPED          "GESTOPPT"
775 781
 	#define MSG_STEPPER_RELEASED "Stepper frei"
776 782
 	#define MSG_CONTROL_RETRACT  "Retract mm"
783
+	#define MSG_CONTROL_RETRACT_SWAP  "Wechs. Retract mm"
777 784
 	#define MSG_CONTROL_RETRACTF "Retract  V"
778 785
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
779 786
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
787
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Wechs. UnRet +mm"
780 788
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
781 789
 	#define MSG_AUTORETRACT      "AutoRetr."
782 790
 	#define MSG_FILAMENTCHANGE "Filament wechseln"
@@ -972,9 +980,11 @@
972 980
 	#define MSG_KILLED "PARADA DE EMERG."
973 981
 	#define MSG_STOPPED "PARADA"
974 982
 	#define MSG_CONTROL_RETRACT  "Retraer mm"
983
+	#define MSG_CONTROL_RETRACT_SWAP  "Interc. Retraer mm"
975 984
 	#define MSG_CONTROL_RETRACTF "Retraer  V"
976 985
 	#define MSG_CONTROL_RETRACT_ZLIFT "Levantar mm"
977 986
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
987
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Interc. DesRet +mm"
978 988
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet V"
979 989
 	#define MSG_AUTORETRACT "AutoRetr."
980 990
 	#define MSG_FILAMENTCHANGE "Cambiar filamento"
@@ -1179,9 +1189,11 @@
1179 1189
 	#define MSG_KILLED							"УБИТО."
1180 1190
 	#define MSG_STOPPED							"ОСТАНОВЛЕНО."
1181 1191
 	#define MSG_CONTROL_RETRACT					"Откат mm:"
1192
+	#define MSG_CONTROL_RETRACT_SWAP				"своп Откат mm:"
1182 1193
 	#define MSG_CONTROL_RETRACTF				"Откат  V:"
1183 1194
 	#define MSG_CONTROL_RETRACT_ZLIFT			"Прыжок mm:"
1184 1195
 	#define MSG_CONTROL_RETRACT_RECOVER			"Возврат +mm:"
1196
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP		"своп Возврат +mm:"
1185 1197
 	#define MSG_CONTROL_RETRACT_RECOVERF		"Возврат  V:"
1186 1198
 	#define MSG_AUTORETRACT						"АвтоОткат:"
1187 1199
 	#define MSG_FILAMENTCHANGE 					"Change filament"
@@ -1376,9 +1388,11 @@
1376 1388
 	#define MSG_KILLED               "UCCISO. "
1377 1389
 	#define MSG_STOPPED              "ARRESTATO. "
1378 1390
 	#define MSG_CONTROL_RETRACT      "Ritrai mm"
1391
+	#define MSG_CONTROL_RETRACT_SWAP "Scamb. Ritrai mm"
1379 1392
 	#define MSG_CONTROL_RETRACTF     "Ritrai  V"
1380 1393
 	#define MSG_CONTROL_RETRACT_ZLIFT "Salta mm"
1381 1394
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
1395
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Scamb. UnRet +mm"
1382 1396
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
1383 1397
 	#define MSG_AUTORETRACT          "AutoArretramento"
1384 1398
 	#define MSG_FILAMENTCHANGE       "Cambia filamento"
@@ -1581,9 +1595,11 @@
1581 1595
 	#define MSG_STOPPED "PARADA. "
1582 1596
 	#define MSG_STEPPER_RELEASED "Lancado."
1583 1597
 	#define MSG_CONTROL_RETRACT  " Retrair mm:"
1598
+	#define MSG_CONTROL_RETRACT_SWAP  "Troca Retrair mm:"
1584 1599
 	#define MSG_CONTROL_RETRACTF " Retrair  V:"
1585 1600
 	#define MSG_CONTROL_RETRACT_ZLIFT " Levantar mm:"
1586 1601
 	#define MSG_CONTROL_RETRACT_RECOVER " DesRet +mm:"
1602
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Troca DesRet +mm:"
1587 1603
 	#define MSG_CONTROL_RETRACT_RECOVERF " DesRet  V:"
1588 1604
 	#define MSG_AUTORETRACT " AutoRetr.:"
1589 1605
 	#define MSG_FILAMENTCHANGE "Change filament"
@@ -1781,9 +1797,11 @@
1781 1797
 	#define MSG_KILLED "KILLED. "
1782 1798
 	#define MSG_STOPPED "STOPPED. "
1783 1799
 	#define MSG_CONTROL_RETRACT  "Veda mm"
1800
+	#define MSG_CONTROL_RETRACT_SWAP  "Va. Veda mm"
1784 1801
 	#define MSG_CONTROL_RETRACTF "Veda V"
1785 1802
 	#define MSG_CONTROL_RETRACT_ZLIFT "Z mm"
1786 1803
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
1804
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Va. UnRet +mm"
1787 1805
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
1788 1806
 	#define MSG_AUTORETRACT "AutoVeto."
1789 1807
 	#define MSG_FILAMENTCHANGE "Change filament"
@@ -1979,9 +1997,11 @@
1979 1997
 	#define MSG_KILLED "ATURADA D'EMERCH."
1980 1998
 	#define MSG_STOPPED "ATURADA."
1981 1999
 	#define MSG_CONTROL_RETRACT  "Retraer mm"
2000
+	#define MSG_CONTROL_RETRACT_SWAP  "Swap Retraer mm"
1982 2001
 	#define MSG_CONTROL_RETRACTF "Retraer  F"
1983 2002
 	#define MSG_CONTROL_RETRACT_ZLIFT "Devantar mm"
1984 2003
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
2004
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Swap DesRet +mm"
1985 2005
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet F"
1986 2006
 	#define MSG_AUTORETRACT "AutoRetr."
1987 2007
 	#define MSG_FILAMENTCHANGE "Cambear"
@@ -2185,9 +2205,11 @@
2185 2205
 	#define MSG_KILLED "AFGEBROKEN. "
2186 2206
 	#define MSG_STOPPED "GESTOPT. "
2187 2207
 	#define MSG_CONTROL_RETRACT  "Retract mm"
2208
+	#define MSG_CONTROL_RETRACT_SWAP "Ruil Retract mm"
2188 2209
 	#define MSG_CONTROL_RETRACTF "Retract  F"
2189 2210
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
2190 2211
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
2212
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Ruil UnRet +mm"
2191 2213
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  F"
2192 2214
 	#define MSG_AUTORETRACT "AutoRetr."
2193 2215
 	#define MSG_FILAMENTCHANGE "Verv. Filament"
@@ -2384,9 +2406,11 @@
2384 2406
 	#define MSG_KILLED "PARADA DE EMERG. "
2385 2407
 	#define MSG_STOPPED "ATURAT. "
2386 2408
 	#define MSG_CONTROL_RETRACT  "Retreure mm"
2409
+	#define MSG_CONTROL_RETRACT_SWAP  "Swap Retreure mm"
2387 2410
 	#define MSG_CONTROL_RETRACTF "Retreure  F"
2388 2411
 	#define MSG_CONTROL_RETRACT_ZLIFT "Aixecar mm"
2389 2412
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
2413
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Swap DesRet +mm"
2390 2414
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet  F"
2391 2415
 	#define MSG_AUTORETRACT "AutoRetr."
2392 2416
 	#define MSG_FILAMENTCHANGE "Canviar filament"
@@ -2582,9 +2606,11 @@
2582 2606
 	#define MSG_KILLED "LARRIALDI GELDIA"
2583 2607
 	#define MSG_STOPPED "GELDITUTA. "
2584 2608
 	#define MSG_CONTROL_RETRACT  "Atzera egin mm"
2609
+	#define MSG_CONTROL_RETRACT_SWAP  "Swap Atzera egin mm"
2585 2610
 	#define MSG_CONTROL_RETRACTF "Atzera egin V"
2586 2611
 	#define MSG_CONTROL_RETRACT_ZLIFT "Igo mm"
2587 2612
 	#define MSG_CONTROL_RETRACT_RECOVER "Atzera egin +mm"
2613
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Swap Atzera egin +mm"
2588 2614
 	#define MSG_CONTROL_RETRACT_RECOVERF "Atzera egin V"
2589 2615
 	#define MSG_AUTORETRACT "Atzera egin"
2590 2616
 	#define MSG_FILAMENTCHANGE "Aldatu filament."

+ 7
- 1
Marlin/ultralcd.cpp Целия файл

@@ -194,7 +194,7 @@ static void lcd_status_screen()
194 194
         currentMenu = lcd_main_menu;
195 195
         encoderPosition = 0;
196 196
         lcd_quick_feedback();
197
-        lcd_implementation_init(); // to maybe revive the LCD if static electricity killed it.
197
+        lcd_implementation_init(); // to maybe revive the LCD if static electricity killed it.
198 198
     }
199 199
 
200 200
 #ifdef ULTIPANEL_FEEDMULTIPLY
@@ -903,9 +903,15 @@ static void lcd_control_retract_menu()
903 903
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
904 904
     MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
905 905
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
906
+    #if EXTRUDERS > 1
907
+      MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100);
908
+    #endif
906 909
     MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999);
907 910
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999);
908 911
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100);
912
+    #if EXTRUDERS > 1
913
+      MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100);
914
+    #endif
909 915
     MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);
910 916
     END_MENU();
911 917
 }

Loading…
Отказ
Запис