Browse Source

Merge remote-tracking branch 'upstream/Marlin_v1' into Marlin_v1

cocktailyogi 10 years ago
parent
commit
1bd0dd04e3
5 changed files with 102 additions and 13 deletions
  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. 6
    0
      Marlin/ultralcd.cpp

+ 2
- 0
Marlin/Configuration_adv.h View File

@@ -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 View File

@@ -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 View File

@@ -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
 
@@ -1119,23 +1137,27 @@ void refresh_cmd_timeout(void)
1119 1137
 }
1120 1138
 
1121 1139
 #ifdef FWRETRACT
1122
-  void retract(bool retracting) {
1123
-    if(retracting && !retracted) {
1140
+  void retract(bool retracting, bool swapretract = false) {
1141
+    if(retracting && !retracted[active_extruder]) {
1124 1142
       destination[X_AXIS]=current_position[X_AXIS];
1125 1143
       destination[Y_AXIS]=current_position[Y_AXIS];
1126 1144
       destination[Z_AXIS]=current_position[Z_AXIS];
1127 1145
       destination[E_AXIS]=current_position[E_AXIS];
1128
-      current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
1146
+      if (swapretract) {
1147
+        current_position[E_AXIS]+=retract_length_swap/volumetric_multiplier[active_extruder];
1148
+      } else {
1149
+        current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
1150
+      }
1129 1151
       plan_set_e_position(current_position[E_AXIS]);
1130 1152
       float oldFeedrate = feedrate;
1131 1153
       feedrate=retract_feedrate*60;
1132
-      retracted=true;
1154
+      retracted[active_extruder]=true;
1133 1155
       prepare_move();
1134 1156
       current_position[Z_AXIS]-=retract_zlift;
1135 1157
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1136 1158
       prepare_move();
1137 1159
       feedrate = oldFeedrate;
1138
-    } else if(!retracting && retracted) {
1160
+    } else if(!retracting && retracted[active_extruder]) {
1139 1161
       destination[X_AXIS]=current_position[X_AXIS];
1140 1162
       destination[Y_AXIS]=current_position[Y_AXIS];
1141 1163
       destination[Z_AXIS]=current_position[Z_AXIS];
@@ -1143,11 +1165,15 @@ void refresh_cmd_timeout(void)
1143 1165
       current_position[Z_AXIS]+=retract_zlift;
1144 1166
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1145 1167
       //prepare_move();
1146
-      current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; 
1168
+      if (swapretract) {
1169
+        current_position[E_AXIS]-=(retract_length_swap+retract_recover_length_swap)/volumetric_multiplier[active_extruder]; 
1170
+      } else {
1171
+        current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; 
1172
+      }
1147 1173
       plan_set_e_position(current_position[E_AXIS]);
1148 1174
       float oldFeedrate = feedrate;
1149 1175
       feedrate=retract_recover_feedrate*60;
1150
-      retracted=false;
1176
+      retracted[active_extruder]=false;
1151 1177
       prepare_move();
1152 1178
       feedrate = oldFeedrate;
1153 1179
     }
@@ -1217,10 +1243,19 @@ void process_commands()
1217 1243
       break;
1218 1244
       #ifdef FWRETRACT
1219 1245
       case 10: // G10 retract
1246
+       #if EXTRUDERS > 1
1247
+        retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument
1248
+        retract(true,retracted_swap[active_extruder]);
1249
+       #else
1220 1250
         retract(true);
1251
+       #endif
1221 1252
       break;
1222 1253
       case 11: // G11 retract_recover
1254
+       #if EXTRUDERS > 1
1255
+        retract(false,retracted_swap[active_extruder]);
1256
+       #else
1223 1257
         retract(false);
1258
+       #endif 
1224 1259
       break;
1225 1260
       #endif //FWRETRACT
1226 1261
     case 28: //G28 Home all Axis one at a time
@@ -2396,8 +2431,28 @@ void process_commands()
2396 2431
         int t= code_value() ;
2397 2432
         switch(t)
2398 2433
         {
2399
-          case 0: autoretract_enabled=false;retracted=false;break;
2400
-          case 1: autoretract_enabled=true;retracted=false;break;
2434
+          case 0: 
2435
+          {
2436
+            autoretract_enabled=false;
2437
+            retracted[0]=false;
2438
+            #if EXTRUDERS > 1
2439
+              retracted[1]=false;
2440
+            #endif
2441
+            #if EXTRUDERS > 2
2442
+              retracted[2]=false;
2443
+            #endif
2444
+          }break;
2445
+          case 1: 
2446
+          {
2447
+            autoretract_enabled=true;
2448
+            retracted[0]=false;
2449
+            #if EXTRUDERS > 1
2450
+              retracted[1]=false;
2451
+            #endif
2452
+            #if EXTRUDERS > 2
2453
+              retracted[2]=false;
2454
+            #endif
2455
+          }break;
2401 2456
           default:
2402 2457
             SERIAL_ECHO_START;
2403 2458
             SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND);

+ 26
- 0
Marlin/language.h View File

@@ -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."

+ 6
- 0
Marlin/ultralcd.cpp View File

@@ -904,9 +904,15 @@ static void lcd_control_retract_menu()
904 904
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
905 905
     MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
906 906
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
907
+    #if EXTRUDERS > 1
908
+      MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100);
909
+    #endif
907 910
     MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999);
908 911
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999);
909 912
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100);
913
+    #if EXTRUDERS > 1
914
+      MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100);
915
+    #endif
910 916
     MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);
911 917
     END_MENU();
912 918
 }

Loading…
Cancel
Save