|
@@ -650,8 +650,8 @@ void setup() {
|
650
|
650
|
#endif
|
651
|
651
|
|
652
|
652
|
#ifdef Z_PROBE_SLED
|
653
|
|
- pinMode(SERVO0_PIN, OUTPUT);
|
654
|
|
- digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
653
|
+ pinMode(SLED_PIN, OUTPUT);
|
|
654
|
+ digitalWrite(SLED_PIN, LOW); // turn it off
|
655
|
655
|
#endif // Z_PROBE_SLED
|
656
|
656
|
|
657
|
657
|
setup_homepin();
|
|
@@ -1516,6 +1516,48 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
|
1516
|
1516
|
|
1517
|
1517
|
#endif // ENABLE_AUTO_BED_LEVELING
|
1518
|
1518
|
|
|
1519
|
+
|
|
1520
|
+#ifdef Z_PROBE_SLED
|
|
1521
|
+
|
|
1522
|
+ #ifndef SLED_DOCKING_OFFSET
|
|
1523
|
+ #define SLED_DOCKING_OFFSET 0
|
|
1524
|
+ #endif
|
|
1525
|
+
|
|
1526
|
+ /**
|
|
1527
|
+ * Method to dock/undock a sled designed by Charles Bell.
|
|
1528
|
+ *
|
|
1529
|
+ * dock[in] If true, move to MAX_X and engage the electromagnet
|
|
1530
|
+ * offset[in] The additional distance to move to adjust docking location
|
|
1531
|
+ */
|
|
1532
|
+ static void dock_sled(bool dock, int offset=0) {
|
|
1533
|
+ if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
|
|
1534
|
+ LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
|
1535
|
+ SERIAL_ECHO_START;
|
|
1536
|
+ SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
|
|
1537
|
+ return;
|
|
1538
|
+ }
|
|
1539
|
+
|
|
1540
|
+ if (dock) {
|
|
1541
|
+ float oldXpos = current_position[X_AXIS]; // save x position
|
|
1542
|
+ do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); // rise Z
|
|
1543
|
+ do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1, current_position[Y_AXIS], current_position[Z_AXIS]); // Dock sled a bit closer to ensure proper capturing
|
|
1544
|
+ digitalWrite(SLED_PIN, LOW); // turn off magnet
|
|
1545
|
+ do_blocking_move_to(oldXpos, current_position[Y_AXIS], current_position[Z_AXIS]); // return to position before docking
|
|
1546
|
+ do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] - Z_RAISE_AFTER_PROBING);
|
|
1547
|
+ } else {
|
|
1548
|
+ float oldXpos = current_position[X_AXIS]; // save x position
|
|
1549
|
+ float z_loc = current_position[Z_AXIS];
|
|
1550
|
+ if (z_loc < Z_RAISE_BEFORE_PROBING + 5) z_loc = Z_RAISE_BEFORE_PROBING;
|
|
1551
|
+ do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], z_loc); // this also updates current_position
|
|
1552
|
+ digitalWrite(SLED_PIN, HIGH); // turn on magnet
|
|
1553
|
+ do_blocking_move_to(oldXpos, current_position[Y_AXIS], current_position[Z_AXIS]); // return to position before docking
|
|
1554
|
+ }
|
|
1555
|
+ }
|
|
1556
|
+
|
|
1557
|
+#endif // Z_PROBE_SLED
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
|
1519
|
1561
|
/**
|
1520
|
1562
|
* Home an individual axis
|
1521
|
1563
|
*/
|
|
@@ -1538,6 +1580,13 @@ static void homeaxis(AxisEnum axis) {
|
1538
|
1580
|
current_position[axis] = 0;
|
1539
|
1581
|
sync_plan_position();
|
1540
|
1582
|
|
|
1583
|
+ #ifdef Z_PROBE_SLED
|
|
1584
|
+ // Get Probe
|
|
1585
|
+ if (axis == Z_AXIS) {
|
|
1586
|
+ if (axis_home_dir < 0) dock_sled(false);
|
|
1587
|
+ }
|
|
1588
|
+ #endif
|
|
1589
|
+
|
1541
|
1590
|
#if SERVO_LEVELING && !defined(Z_PROBE_SLED)
|
1542
|
1591
|
|
1543
|
1592
|
// Deploy a probe if there is one, and homing towards the bed
|
|
@@ -1634,6 +1683,13 @@ static void homeaxis(AxisEnum axis) {
|
1634
|
1683
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
1635
|
1684
|
axis_known_position[axis] = true;
|
1636
|
1685
|
|
|
1686
|
+ #ifdef Z_PROBE_SLED
|
|
1687
|
+ // bring probe back
|
|
1688
|
+ if (axis == Z_AXIS) {
|
|
1689
|
+ if (axis_home_dir < 0) dock_sled(true);
|
|
1690
|
+ }
|
|
1691
|
+ #endif
|
|
1692
|
+
|
1637
|
1693
|
#if SERVO_LEVELING && !defined(Z_PROBE_SLED)
|
1638
|
1694
|
|
1639
|
1695
|
// Deploy a probe if there is one, and homing towards the bed
|
|
@@ -1708,39 +1764,6 @@ static void homeaxis(AxisEnum axis) {
|
1708
|
1764
|
|
1709
|
1765
|
#endif // FWRETRACT
|
1710
|
1766
|
|
1711
|
|
-#ifdef Z_PROBE_SLED
|
1712
|
|
-
|
1713
|
|
- #ifndef SLED_DOCKING_OFFSET
|
1714
|
|
- #define SLED_DOCKING_OFFSET 0
|
1715
|
|
- #endif
|
1716
|
|
-
|
1717
|
|
- /**
|
1718
|
|
- * Method to dock/undock a sled designed by Charles Bell.
|
1719
|
|
- *
|
1720
|
|
- * dock[in] If true, move to MAX_X and engage the electromagnet
|
1721
|
|
- * offset[in] The additional distance to move to adjust docking location
|
1722
|
|
- */
|
1723
|
|
- static void dock_sled(bool dock, int offset=0) {
|
1724
|
|
- if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
|
1725
|
|
- LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
1726
|
|
- SERIAL_ECHO_START;
|
1727
|
|
- SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
|
1728
|
|
- return;
|
1729
|
|
- }
|
1730
|
|
-
|
1731
|
|
- if (dock) {
|
1732
|
|
- do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], current_position[Z_AXIS]); // this also updates current_position
|
1733
|
|
- digitalWrite(SERVO0_PIN, LOW); // turn off magnet
|
1734
|
|
- } else {
|
1735
|
|
- float z_loc = current_position[Z_AXIS];
|
1736
|
|
- if (z_loc < Z_RAISE_BEFORE_PROBING + 5) z_loc = Z_RAISE_BEFORE_PROBING;
|
1737
|
|
- do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, Y_PROBE_OFFSET_FROM_EXTRUDER, z_loc); // this also updates current_position
|
1738
|
|
- digitalWrite(SERVO0_PIN, HIGH); // turn on magnet
|
1739
|
|
- }
|
1740
|
|
- }
|
1741
|
|
-
|
1742
|
|
-#endif // Z_PROBE_SLED
|
1743
|
|
-
|
1744
|
1767
|
/**
|
1745
|
1768
|
*
|
1746
|
1769
|
* G-Code Handler functions
|
|
@@ -2000,12 +2023,12 @@ inline void gcode_G28() {
|
2000
|
2023
|
|
2001
|
2024
|
if (home_all_axis || homeZ) {
|
2002
|
2025
|
|
2003
|
|
- #ifdef Z_SAFE_HOMING
|
|
2026
|
+ #ifdef Z_SAFE_HOMING
|
2004
|
2027
|
|
2005
|
2028
|
if (home_all_axis) {
|
2006
|
2029
|
|
2007
|
2030
|
current_position[Z_AXIS] = 0;
|
2008
|
|
- sync_plan_position();
|
|
2031
|
+ sync_plan_position();
|
2009
|
2032
|
|
2010
|
2033
|
//
|
2011
|
2034
|
// Set the probe (or just the nozzle) destination to the safe homing point
|
|
@@ -2586,7 +2609,7 @@ inline void gcode_G28() {
|
2586
|
2609
|
#endif // !DELTA
|
2587
|
2610
|
|
2588
|
2611
|
#ifdef Z_PROBE_SLED
|
2589
|
|
- dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel
|
|
2612
|
+ dock_sled(true); // dock the probe
|
2590
|
2613
|
#elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING)
|
2591
|
2614
|
stow_z_probe();
|
2592
|
2615
|
#endif
|