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 12 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
 // #define FWRETRACT  //ONLY PARTIALLY TESTED
292
 // #define FWRETRACT  //ONLY PARTIALLY TESTED
293
 #define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt
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
 //=============================  Define Defines  ============================
309
 //=============================  Define Defines  ============================
297
 //===========================================================================
310
 //===========================================================================

+ 125
- 0
Marlin/Marlin_main.cpp View File

126
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
126
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
127
 // M503 - print the current settings (from memory not from eeprom)
127
 // M503 - print the current settings (from memory not from eeprom)
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)
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
 // M907 - Set digital trimpot motor current using axis codes.
130
 // M907 - Set digital trimpot motor current using axis codes.
130
 // M908 - Control digital trimpot directly.
131
 // M908 - Control digital trimpot directly.
131
 // M350 - Set microstepping mode.
132
 // M350 - Set microstepping mode.
1506
     }
1507
     }
1507
     break;
1508
     break;
1508
     #endif
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
     case 907: // M907 Set digital trimpot motor current using axis codes.
1634
     case 907: // M907 Set digital trimpot motor current using axis codes.
1510
     {
1635
     {
1511
       #if DIGIPOTSS_PIN > -1
1636
       #if DIGIPOTSS_PIN > -1

+ 9
- 1
Marlin/language.h View File

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

+ 3
- 0
Marlin/ultralcd.cpp View File

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

Loading…
Cancel
Save