Browse Source

Added a feature to have filament change by gcode or display trigger.

[default off for now]
syntax: M600  X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]

if enabled, after a M600, the printer will retract by E, lift by Z, move to XY, retract even more filament.
Oh, and it will display "remove filament" and beep like crazy.

You are then supposed to insert a new filament (other color, e.g.) and click the display to continue.
After having the nozzle cleaned manually, aided by the disabled e-steppers.
After clicking, the printer will then go back the whole shebang, and continue printing with a fancy new color.
Bernhard 11 years ago
parent
commit
1d06b10962
4 changed files with 150 additions and 1 deletions
  1. 13
    0
      Marlin/Configuration_adv.h
  2. 125
    0
      Marlin/Marlin_main.cpp
  3. 9
    1
      Marlin/language.h
  4. 3
    0
      Marlin/ultralcd.cpp

+ 13
- 0
Marlin/Configuration_adv.h View File

@@ -292,6 +292,19 @@ const unsigned int dropsegments=5; //everything with less than this number of st
292 292
 // #define FWRETRACT  //ONLY PARTIALLY TESTED
293 293
 #define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt
294 294
 
295
+
296
+//adds support for experimental filament exchange support M600; requires display
297
+#ifdef ULTIPANEL
298
+  //#define FILAMENTCHANGEENABLE
299
+  #ifdef FILAMENTCHANGEENABLE
300
+    #define FILAMENTCHANGE_XPOS 3
301
+    #define FILAMENTCHANGE_YPOS 3
302
+    #define FILAMENTCHANGE_ZADD 10
303
+    #define FILAMENTCHANGE_FIRSTRETRACT -2
304
+    #define FILAMENTCHANGE_FINALRETRACT -100
305
+  #endif
306
+#endif
307
+ 
295 308
 //===========================================================================
296 309
 //=============================  Define Defines  ============================
297 310
 //===========================================================================

+ 125
- 0
Marlin/Marlin_main.cpp View File

@@ -126,6 +126,7 @@
126 126
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
127 127
 // M503 - print the current settings (from memory not from eeprom)
128 128
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
129
+// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
129 130
 // M907 - Set digital trimpot motor current using axis codes.
130 131
 // M908 - Control digital trimpot directly.
131 132
 // M350 - Set microstepping mode.
@@ -1506,6 +1507,130 @@ void process_commands()
1506 1507
     }
1507 1508
     break;
1508 1509
     #endif
1510
+    #ifdef FILAMENTCHANGEENABLE
1511
+    case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
1512
+    {
1513
+        float target[4];
1514
+        float lastpos[4];
1515
+        target[X_AXIS]=current_position[X_AXIS];
1516
+        target[Y_AXIS]=current_position[Y_AXIS];
1517
+        target[Z_AXIS]=current_position[Z_AXIS];
1518
+        target[E_AXIS]=current_position[E_AXIS];
1519
+        lastpos[X_AXIS]=current_position[X_AXIS];
1520
+        lastpos[Y_AXIS]=current_position[Y_AXIS];
1521
+        lastpos[Z_AXIS]=current_position[Z_AXIS];
1522
+        lastpos[E_AXIS]=current_position[E_AXIS];
1523
+        //retract by E
1524
+        if(code_seen('E')) 
1525
+        {
1526
+          target[E_AXIS]+= code_value();
1527
+        }
1528
+        else
1529
+        {
1530
+          #ifdef FILAMENTCHANGE_FIRSTRETRACT
1531
+            target[E_AXIS]+= FILAMENTCHANGE_FIRSTRETRACT ;
1532
+          #endif
1533
+        }
1534
+        plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
1535
+        
1536
+        //lift Z
1537
+        if(code_seen('Z')) 
1538
+        {
1539
+          target[Z_AXIS]+= code_value();
1540
+        }
1541
+        else
1542
+        {
1543
+          #ifdef FILAMENTCHANGE_ZADD
1544
+            target[Z_AXIS]+= FILAMENTCHANGE_ZADD ;
1545
+          #endif
1546
+        }
1547
+        plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
1548
+        
1549
+        //move xy
1550
+        if(code_seen('X')) 
1551
+        {
1552
+          target[X_AXIS]+= code_value();
1553
+        }
1554
+        else
1555
+        {
1556
+          #ifdef FILAMENTCHANGE_XPOS
1557
+            target[X_AXIS]= FILAMENTCHANGE_XPOS ;
1558
+          #endif
1559
+        }
1560
+        if(code_seen('Y')) 
1561
+        {
1562
+          target[Y_AXIS]= code_value();
1563
+        }
1564
+        else
1565
+        {
1566
+          #ifdef FILAMENTCHANGE_YPOS
1567
+            target[Y_AXIS]= FILAMENTCHANGE_YPOS ;
1568
+          #endif
1569
+        }
1570
+        
1571
+        plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
1572
+        
1573
+        if(code_seen('L'))
1574
+        {
1575
+          target[E_AXIS]+= code_value();
1576
+        }
1577
+        else
1578
+        {
1579
+          #ifdef FILAMENTCHANGE_FINALRETRACT
1580
+            target[E_AXIS]+= FILAMENTCHANGE_FINALRETRACT ;
1581
+          #endif
1582
+        }
1583
+        
1584
+        plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
1585
+        
1586
+        //finish moves
1587
+        st_synchronize();
1588
+        //disable extruder steppers so filament can be removed
1589
+        disable_e0();
1590
+        disable_e1();
1591
+        disable_e2();
1592
+        delay(100);
1593
+        LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
1594
+        uint8_t cnt=0;
1595
+        while(!LCD_CLICKED){
1596
+          cnt++;
1597
+          manage_heater();
1598
+          manage_inactivity();
1599
+          lcd_update();
1600
+          
1601
+          #if BEEPER > -1
1602
+          if(cnt==0)
1603
+          {
1604
+            SET_OUTPUT(BEEPER);
1605
+            
1606
+            WRITE(BEEPER,HIGH);
1607
+            delay(3);
1608
+            WRITE(BEEPER,LOW);
1609
+            delay(3);
1610
+          }
1611
+          #endif
1612
+        }
1613
+        
1614
+        //return to normal
1615
+        if(code_seen('L')) 
1616
+        {
1617
+          target[E_AXIS]+= -code_value();
1618
+        }
1619
+        else
1620
+        {
1621
+          #ifdef FILAMENTCHANGE_FINALRETRACT
1622
+            target[E_AXIS]+=(-1)*FILAMENTCHANGE_FINALRETRACT ;
1623
+          #endif
1624
+        }
1625
+        current_position[E_AXIS]=target[E_AXIS]; //the long retract of L is compensated by manual filament feeding
1626
+        plan_set_e_position(current_position[E_AXIS]);
1627
+        plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder); //should do nothing
1628
+        plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder); //move xy back
1629
+        plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder); //move z back
1630
+        plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], feedrate/60, active_extruder); //final untretract
1631
+    }
1632
+    break;
1633
+    #endif //FILAMENTCHANGEENABLE    
1509 1634
     case 907: // M907 Set digital trimpot motor current using axis codes.
1510 1635
     {
1511 1636
       #if DIGIPOTSS_PIN > -1

+ 9
- 1
Marlin/language.h View File

@@ -113,6 +113,7 @@
113 113
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
114 114
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  F"
115 115
 	#define MSG_AUTORETRACT "AutoRetr."
116
+	#define MSG_FILAMENTCHANGE "Change filament"
116 117
 
117 118
 // Serial Console Messages
118 119
 
@@ -267,6 +268,7 @@
267 268
 	#define MSG_CONTROL_RETRACT_RECOVER "Cof. wycof. +mm"
268 269
 	#define MSG_CONTROL_RETRACT_RECOVERF "Cof. wycof.  F"
269 270
 	#define MSG_AUTORETRACT "Auto. wycofanie"
271
+	#define MSG_FILAMENTCHANGE "Change filament"
270 272
 
271 273
 // Serial Console Messages
272 274
 
@@ -426,6 +428,7 @@
426 428
 #define MSG_CONTROL_RETRACT_RECOVER " UnRet +mm:"
427 429
 #define MSG_CONTROL_RETRACT_RECOVERF " UnRet F:"
428 430
 #define MSG_AUTORETRACT " Retract. Auto.:"
431
+#define MSG_FILAMENTCHANGE "Change filament"
429 432
 
430 433
 // Serial Console Messages
431 434
 
@@ -583,6 +586,7 @@
583 586
     #define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
584 587
     #define MSG_CONTROL_RETRACT_RECOVERF "UnRet  F"
585 588
     #define MSG_AUTORETRACT      "AutoRetr."
589
+    #define MSG_FILAMENTCHANGE "Filament wechseln"
586 590
 	
587 591
 // Serial Console Messages
588 592
 
@@ -741,7 +745,7 @@
741 745
 #define MSG_CONTROL_RETRACT_RECOVER " DesRet +mm:"
742 746
 #define MSG_CONTROL_RETRACT_RECOVERF " DesRet F:"
743 747
 #define MSG_AUTORETRACT " AutoRetr.:"
744
-
748
+#define MSG_FILAMENTCHANGE "Change filament"
745 749
 // Serial Console Messages
746 750
 
747 751
 #define MSG_Enqueing "En cola \""
@@ -891,6 +895,7 @@
891 895
 #define MSG_CONTROL_RETRACT_RECOVER			" Возврат +mm:"
892 896
 #define MSG_CONTROL_RETRACT_RECOVERF		" Возврат  F:"
893 897
 #define MSG_AUTORETRACT						" АвтоОткат:"
898
+#define MSG_FILAMENTCHANGE "Change filament"
894 899
 
895 900
 // Serial Console Messages
896 901
 
@@ -1049,6 +1054,7 @@
1049 1054
 	#define MSG_CONTROL_RETRACT_RECOVERF " UnRet  F:"
1050 1055
 	#define MSG_AUTORETRACT          " AutoRilascio.:"
1051 1056
 	#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Qualcosa non va in MenuStructure."
1057
+	#define MSG_FILAMENTCHANGE "Change filament"
1052 1058
 
1053 1059
 	// Serial Console Messages
1054 1060
 
@@ -1210,6 +1216,7 @@
1210 1216
 	#define MSG_CONTROL_RETRACT_RECOVERF " DesRet  F:"
1211 1217
 	#define MSG_AUTORETRACT " AutoRetr.:"
1212 1218
         #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Algo esta errado na estrutura do Menu."
1219
+        #define MSG_FILAMENTCHANGE "Change filament"
1213 1220
 
1214 1221
 // Serial Console Messages
1215 1222
 
@@ -1366,6 +1373,7 @@
1366 1373
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
1367 1374
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  F"
1368 1375
 	#define MSG_AUTORETRACT "AutoVeto."
1376
+	#define MSG_FILAMENTCHANGE "Change filament"
1369 1377
 
1370 1378
 // Serial Console Messages
1371 1379
 

+ 3
- 0
Marlin/ultralcd.cpp View File

@@ -252,6 +252,9 @@ static void lcd_tune_menu()
252 252
 #endif
253 253
     MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
254 254
     MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
255
+#ifdef FILAMENTCHANGEENABLE
256
+     MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600"));
257
+#endif
255 258
     END_MENU();
256 259
 }
257 260
 

Loading…
Cancel
Save