Quellcode durchsuchen

Simplify dock_sled()

`dock_sled()` is never called with offset parameter - remove it.
We move x only - so only that needs to be homed. Consequence is - we can home to z-min now with a sled probe!
Feedrates are set and restored in `do_blocking_move()`.
We already checked if the probe is deployed/stowed in deploy/stow_probe.
```
if (z_loc < _Z_RAISE_PROBE_DEPLOY_STOW + 5) z_loc = _Z_RAISE_PROBE_DEPLOY_STOW;
```
makes no sense - remove.
Now the raise is the same for deploy/stow -> move before the if.
Replace the if with a ternary.
Instead writing LOW/HIGH use the boolean `stow` we already have.

There is no reason for not using the sled probe in G29/M48 with 'E'.
It takes a while but works. (tested!)
AnHardt vor 9 Jahren
Ursprung
Commit
e616093d4c
1 geänderte Dateien mit 12 neuen und 27 gelöschten Zeilen
  1. 12
    27
      Marlin/Marlin_main.cpp

+ 12
- 27
Marlin/Marlin_main.cpp Datei anzeigen

@@ -1746,45 +1746,30 @@ static void clean_up_after_endstop_or_probe_move() {
1746 1746
   /**
1747 1747
    * Method to dock/undock a sled designed by Charles Bell.
1748 1748
    *
1749
-   * dock[in]     If true, move to MAX_X and engage the electromagnet
1750
-   * offset[in]   The additional distance to move to adjust docking location
1749
+   * stow[in]     If false, move to MAX_X and engage the solenoid
1750
+   *              If true, move to MAX_X and release the solenoid
1751 1751
    */
1752
-  static void dock_sled(bool dock, int offset = 0) {
1752
+  static void dock_sled(bool stow) {
1753 1753
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1754 1754
       if (DEBUGGING(LEVELING)) {
1755
-        SERIAL_ECHOPAIR("dock_sled(", dock);
1755
+        SERIAL_ECHOPAIR("dock_sled(", stow);
1756 1756
         SERIAL_ECHOLNPGM(")");
1757 1757
       }
1758 1758
     #endif
1759 1759
 
1760
-    if (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS] || !axis_homed[Z_AXIS]) {
1760
+    if (!axis_homed[X_AXIS]) {
1761 1761
       axis_unhomed_error(true);
1762 1762
       return;
1763 1763
     }
1764 1764
 
1765
-    if (endstops.z_probe_enabled == !dock) return; // already docked/undocked?
1766
-
1767 1765
     float oldXpos = current_position[X_AXIS]; // save x position
1768
-    float old_feedrate = feedrate;
1769
-    if (dock) {
1770
-      #if _Z_RAISE_PROBE_DEPLOY_STOW > 0
1771
-        do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
1772
-      #endif
1773
-      // Dock sled a bit closer to ensure proper capturing
1774
-      feedrate = XY_PROBE_FEEDRATE;
1775
-      do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1);
1776
-      digitalWrite(SLED_PIN, LOW); // turn off magnet
1777
-    }
1778
-    else {
1779
-      feedrate = XY_PROBE_FEEDRATE;
1780
-      float z_loc = current_position[Z_AXIS];
1781
-      if (z_loc < _Z_RAISE_PROBE_DEPLOY_STOW + 5) z_loc = _Z_RAISE_PROBE_DEPLOY_STOW;
1782
-      do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], z_loc); // this also updates current_position
1783
-      digitalWrite(SLED_PIN, HIGH); // turn on magnet
1784
-    }
1766
+
1767
+    // Dock sled a bit closer to ensure proper capturing
1768
+    do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET - ((stow) ? 1 : 0));
1769
+    digitalWrite(SLED_PIN, !stow); // switch solenoid
1770
+
1785 1771
     do_blocking_move_to_x(oldXpos); // return to position before docking
1786 1772
 
1787
-    feedrate = old_feedrate;
1788 1773
   }
1789 1774
 
1790 1775
 #endif // Z_PROBE_SLED
@@ -3394,7 +3379,7 @@ inline void gcode_G28() {
3394 3379
 
3395 3380
     bool dryrun = code_seen('D');
3396 3381
 
3397
-    #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
3382
+    #if ENABLED(Z_PROBE_ALLEN_KEY)
3398 3383
       const bool stow_probe_after_each = false;
3399 3384
     #else
3400 3385
       bool stow_probe_after_each = code_seen('E');
@@ -4159,7 +4144,7 @@ inline void gcode_M42() {
4159 4144
     float  X_current = current_position[X_AXIS],
4160 4145
            Y_current = current_position[Y_AXIS];
4161 4146
 
4162
-    #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
4147
+    #if ENABLED(Z_PROBE_ALLEN_KEY)
4163 4148
       const bool stow_probe_after_each = false;
4164 4149
     #else
4165 4150
       bool stow_probe_after_each = code_seen('E');

Laden…
Abbrechen
Speichern