瀏覽代碼

sled improvements

- create sled pin definition
- G28 Works with sled
Christian Bohn 10 年之前
父節點
當前提交
fb44b53ae3
共有 3 個文件被更改,包括 72 次插入38 次删除
  1. 7
    0
      Marlin/Conditionals.h
  2. 61
    38
      Marlin/Marlin_main.cpp
  3. 4
    0
      Marlin/pins_SANGUINOLOLU_11.h

+ 7
- 0
Marlin/Conditionals.h 查看文件

276
     #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
276
     #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
277
   #endif
277
   #endif
278
 
278
 
279
+   /**
280
+    * Sled Options
281
+    */ 
282
+  #ifdef Z_PROBE_SLED
283
+    #define Z_SAFE_HOMING
284
+  #endif
285
+  
279
   /**
286
   /**
280
    * MAX_STEP_FREQUENCY differs for TOSHIBA
287
    * MAX_STEP_FREQUENCY differs for TOSHIBA
281
    */
288
    */

+ 61
- 38
Marlin/Marlin_main.cpp 查看文件

650
   #endif
650
   #endif
651
 
651
 
652
   #ifdef Z_PROBE_SLED
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
   #endif // Z_PROBE_SLED
655
   #endif // Z_PROBE_SLED
656
 
656
 
657
   setup_homepin();
657
   setup_homepin();
1516
 
1516
 
1517
 #endif // ENABLE_AUTO_BED_LEVELING
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
  * Home an individual axis
1562
  * Home an individual axis
1521
  */
1563
  */
1538
     current_position[axis] = 0;
1580
     current_position[axis] = 0;
1539
     sync_plan_position();
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
     #if SERVO_LEVELING && !defined(Z_PROBE_SLED)
1590
     #if SERVO_LEVELING && !defined(Z_PROBE_SLED)
1542
 
1591
 
1543
       // Deploy a probe if there is one, and homing towards the bed
1592
       // Deploy a probe if there is one, and homing towards the bed
1634
     endstops_hit_on_purpose(); // clear endstop hit flags
1683
     endstops_hit_on_purpose(); // clear endstop hit flags
1635
     axis_known_position[axis] = true;
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
     #if SERVO_LEVELING && !defined(Z_PROBE_SLED)
1693
     #if SERVO_LEVELING && !defined(Z_PROBE_SLED)
1638
 
1694
 
1639
       // Deploy a probe if there is one, and homing towards the bed
1695
       // Deploy a probe if there is one, and homing towards the bed
1708
 
1764
 
1709
 #endif // FWRETRACT
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
  * G-Code Handler functions
1769
  * G-Code Handler functions
2000
 
2023
 
2001
       if (home_all_axis || homeZ) {
2024
       if (home_all_axis || homeZ) {
2002
 
2025
 
2003
-        #ifdef Z_SAFE_HOMING
2026
+        #ifdef Z_SAFE_HOMING    
2004
 
2027
 
2005
           if (home_all_axis) {
2028
           if (home_all_axis) {
2006
 
2029
 
2007
             current_position[Z_AXIS] = 0;
2030
             current_position[Z_AXIS] = 0;
2008
-            sync_plan_position();
2031
+            sync_plan_position();         
2009
 
2032
 
2010
             //
2033
             //
2011
             // Set the probe (or just the nozzle) destination to the safe homing point
2034
             // Set the probe (or just the nozzle) destination to the safe homing point
2586
     #endif // !DELTA
2609
     #endif // !DELTA
2587
 
2610
 
2588
     #ifdef Z_PROBE_SLED
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
     #elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING)
2613
     #elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING)
2591
       stow_z_probe();
2614
       stow_z_probe();
2592
     #endif
2615
     #endif

+ 4
- 0
Marlin/pins_SANGUINOLOLU_11.h 查看文件

44
   #define FAN_PIN            4
44
   #define FAN_PIN            4
45
 #endif
45
 #endif
46
 
46
 
47
+#ifdef Z_PROBE_SLED
48
+  #define SLED_PIN         27
49
+#endif
50
+
47
 #ifdef NUM_SERVOS
51
 #ifdef NUM_SERVOS
48
   #define SERVO0_PIN          -1
52
   #define SERVO0_PIN          -1
49
 
53
 

Loading…
取消
儲存