瀏覽代碼

Merge pull request #3288 from thinkyhead/rc_servo_plus_delta

Fix servo deploy/stow issues with G29 and Delta
Scott Lahteine 9 年之前
父節點
當前提交
4f85226106
共有 2 個文件被更改,包括 45 次插入48 次删除
  1. 1
    1
      Marlin/Conditionals.h
  2. 44
    47
      Marlin/Marlin_main.cpp

+ 1
- 1
Marlin/Conditionals.h 查看文件

339
     #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
339
     #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
340
   #endif
340
   #endif
341
 
341
 
342
-  #define SERVO_LEVELING (defined(AUTO_BED_LEVELING_FEATURE) && defined(Z_ENDSTOP_SERVO_NR))
342
+  #define SERVO_LEVELING (ENABLED(AUTO_BED_LEVELING_FEATURE) && defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
343
 
343
 
344
   /**
344
   /**
345
    * Sled Options
345
    * Sled Options

+ 44
- 47
Marlin/Marlin_main.cpp 查看文件

1999
     sync_plan_position();
1999
     sync_plan_position();
2000
 
2000
 
2001
     #if ENABLED(Z_PROBE_SLED)
2001
     #if ENABLED(Z_PROBE_SLED)
2002
-      // Get Probe
2003
-      if (axis == Z_AXIS) {
2004
-        if (axis_home_dir < 0) dock_sled(false);
2005
-      }
2002
+      #define _Z_SERVO_TEST       (axis != Z_AXIS)      // deploy Z, servo.move XY
2003
+      #define _Z_PROBE_SUBTEST    false                 // Z will never be invoked
2004
+      #define _Z_DEPLOY           (dock_sled(false))
2005
+      #define _Z_STOW             (dock_sled(true))
2006
     #elif SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
2006
     #elif SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
2007
-
2008
-      // Deploy a Z probe if there is one, and homing towards the bed
2009
-      if (axis == Z_AXIS) {
2010
-        if (axis_home_dir < 0) deploy_z_probe();
2011
-      }
2012
-
2007
+      #define _Z_SERVO_TEST       (axis != Z_AXIS)      // servo.move XY
2008
+      #define _Z_PROBE_SUBTEST    false                 // Z will never be invoked
2009
+      #define _Z_DEPLOY           (deploy_z_probe())
2010
+      #define _Z_STOW             (stow_z_probe())
2011
+    #elif HAS_SERVO_ENDSTOPS
2012
+      #define _Z_SERVO_TEST       true                  // servo.move X, Y, Z
2013
+      #define _Z_PROBE_SUBTEST    (axis == Z_AXIS)      // Z is a probe
2013
     #endif
2014
     #endif
2014
 
2015
 
2016
+    if (axis == Z_AXIS) {
2017
+      // If there's a Z probe that needs deployment...
2018
+      #if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
2019
+        // ...and homing Z towards the bed? Deploy it.
2020
+        if (axis_home_dir < 0) _Z_DEPLOY;
2021
+      #endif
2022
+    }
2023
+
2015
     #if HAS_SERVO_ENDSTOPS
2024
     #if HAS_SERVO_ENDSTOPS
2016
-      // Engage Servo endstop if enabled
2017
-      if (axis != Z_AXIS && servo_endstop_id[axis] >= 0) {
2025
+      // Engage an X or Y Servo endstop if enabled
2026
+      if (_Z_SERVO_TEST && servo_endstop_id[axis] >= 0) {
2018
         servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][0]);
2027
         servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][0]);
2019
-        z_probe_is_active = true;
2028
+        if (_Z_PROBE_SUBTEST) z_probe_is_active = true;
2020
       }
2029
       }
2021
     #endif
2030
     #endif
2022
 
2031
 
2145
     axis_known_position[axis] = true;
2154
     axis_known_position[axis] = true;
2146
     axis_homed[axis] = true;
2155
     axis_homed[axis] = true;
2147
 
2156
 
2148
-    #if ENABLED(Z_PROBE_SLED)
2149
-      // bring Z probe back
2150
-      if (axis == Z_AXIS) {
2151
-        if (axis_home_dir < 0) dock_sled(true);
2157
+    // Put away the Z probe
2158
+    #if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
2159
+      if (axis == Z_AXIS && axis_home_dir < 0) {
2160
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
2161
+          if (DEBUGGING(LEVELING)) {
2162
+            SERIAL_ECHOLNPGM("> SERVO_LEVELING > " STRINGIFY(_Z_STOW));
2163
+          }
2164
+        #endif
2165
+        _Z_STOW;
2152
       }
2166
       }
2153
-    #elif SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
2167
+    #endif
2154
 
2168
 
2155
-      // Deploy a Z probe if there is one, and homing towards the bed
2156
-      if (axis == Z_AXIS) {
2157
-        if (axis_home_dir < 0) {
2158
-          #if ENABLED(DEBUG_LEVELING_FEATURE)
2159
-            if (DEBUGGING(LEVELING)) {
2160
-              SERIAL_ECHOLNPGM("> SERVO_LEVELING > stow_z_probe");
2161
-            }
2162
-          #endif
2163
-          stow_z_probe();
2164
-        }
2169
+    // Retract Servo endstop if enabled
2170
+    #if HAS_SERVO_ENDSTOPS
2171
+      if (_Z_SERVO_TEST && servo_endstop_id[axis] >= 0) {
2172
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
2173
+          if (DEBUGGING(LEVELING)) {
2174
+            SERIAL_ECHOLNPGM("> SERVO_ENDSTOPS > Stow with servo.move()");
2175
+          }
2176
+        #endif
2177
+        servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][1]);
2178
+        if (_Z_PROBE_SUBTEST) z_probe_is_active = false;
2165
       }
2179
       }
2166
-      else
2167
-
2168
     #endif
2180
     #endif
2169
 
2181
 
2170
-    {
2171
-      #if HAS_SERVO_ENDSTOPS
2172
-        // Retract Servo endstop if enabled
2173
-        if (servo_endstop_id[axis] >= 0) {
2174
-          #if ENABLED(DEBUG_LEVELING_FEATURE)
2175
-            if (DEBUGGING(LEVELING)) {
2176
-              SERIAL_ECHOLNPGM("> SERVO_ENDSTOPS > Stow with servo.move()");
2177
-            }
2178
-          #endif
2179
-          servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][1]);
2180
-          z_probe_is_active = false;
2181
-        }
2182
-      #endif
2183
-    }
2184
-
2185
   }
2182
   }
2186
 
2183
 
2187
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2184
   #if ENABLED(DEBUG_LEVELING_FEATURE)
3074
 
3071
 
3075
     #if ENABLED(Z_PROBE_SLED)
3072
     #if ENABLED(Z_PROBE_SLED)
3076
       dock_sled(false); // engage (un-dock) the Z probe
3073
       dock_sled(false); // engage (un-dock) the Z probe
3077
-    #elif ENABLED(Z_PROBE_ALLEN_KEY) //|| SERVO_LEVELING
3074
+    #elif ENABLED(Z_PROBE_ALLEN_KEY) || (ENABLED(DELTA) && SERVO_LEVELING)
3078
       deploy_z_probe();
3075
       deploy_z_probe();
3079
     #endif
3076
     #endif
3080
 
3077
 
3342
 
3339
 
3343
     #if ENABLED(DELTA)
3340
     #if ENABLED(DELTA)
3344
       // Allen Key Probe for Delta
3341
       // Allen Key Probe for Delta
3345
-      #if ENABLED(Z_PROBE_ALLEN_KEY)
3342
+      #if ENABLED(Z_PROBE_ALLEN_KEY) || SERVO_LEVELING
3346
         stow_z_probe();
3343
         stow_z_probe();
3347
       #elif Z_RAISE_AFTER_PROBING > 0
3344
       #elif Z_RAISE_AFTER_PROBING > 0
3348
         raise_z_after_probing(); // ???
3345
         raise_z_after_probing(); // ???

Loading…
取消
儲存