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