Browse Source

Add UNKNOWN_Z_NO_RAISE option

With this option enabled, Z won't ever be raised until after `G28` has been completed, and it won't raise if Z becomes unknown. This is good for machines whose beds fall when Z is powered off.
Scott Lahteine 6 years ago
parent
commit
419d12ca1b
3 changed files with 25 additions and 9 deletions
  1. 2
    0
      Marlin/Configuration.h
  2. 8
    2
      Marlin/src/gcode/calibrate/G28.cpp
  3. 15
    7
      Marlin/src/module/probe.cpp

+ 2
- 0
Marlin/Configuration.h View File

@@ -804,6 +804,8 @@
804 804
 
805 805
 //#define NO_MOTION_BEFORE_HOMING  // Inhibit movement until all axes have been homed
806 806
 
807
+//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off.
808
+
807 809
 //#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
808 810
                              // Be sure you have this distance over your Z_MAX_POS in case.
809 811
 

+ 8
- 2
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -221,9 +221,15 @@ void GcodeSuite::G28(const bool always_home_all) {
221 221
 
222 222
     #endif
223 223
 
224
-    if (home_all || homeX || homeY) {
224
+    #if ENABLED(UNKNOWN_Z_NO_RAISE)
225
+      const float z_homing_height = axis_known_position[Z_AXIS] ? Z_HOMING_HEIGHT : 0;
226
+    #else
227
+      constexpr float z_homing_height = Z_HOMING_HEIGHT;
228
+    #endif
229
+
230
+    if (z_homing_height && (home_all || homeX || homeY)) {
225 231
       // Raise Z before homing any other axes and z is not already high enough (never lower z)
226
-      destination[Z_AXIS] = Z_HOMING_HEIGHT;
232
+      destination[Z_AXIS] = z_homing_height;
227 233
       if (destination[Z_AXIS] > current_position[Z_AXIS]) {
228 234
 
229 235
         #if ENABLED(DEBUG_LEVELING_FEATURE)

+ 15
- 7
Marlin/src/module/probe.cpp View File

@@ -378,13 +378,21 @@ bool set_probe_deployed(const bool deploy) {
378 378
 
379 379
   // Make room for probe to deploy (or stow)
380 380
   // Fix-mounted probe should only raise for deploy
381
-  if (
382
-    #if ENABLED(FIX_MOUNTED_PROBE)
383
-      deploy
384
-    #else
385
-      true
386
-    #endif
387
-  ) do_probe_raise(max(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
381
+  #if ENABLED(FIX_MOUNTED_PROBE)
382
+    const bool deploy_stow_condition = deploy;
383
+  #else
384
+    constexpr bool deploy_stow_condition = true;
385
+  #endif
386
+
387
+  // For beds that fall when Z is powered off only raise for trusted Z
388
+  #if ENABLED(UNKNOWN_Z_NO_RAISE)
389
+    const bool unknown_condition = axis_known_position[Z_AXIS];
390
+  #else
391
+    constexpr float unknown_condition = true;
392
+  #endif
393
+
394
+  if (deploy_stow_condition && unknown_condition)
395
+    do_probe_raise(max(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
388 396
 
389 397
   #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
390 398
     #if ENABLED(Z_PROBE_SLED)

Loading…
Cancel
Save