Просмотр исходного кода

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 лет назад
Родитель
Сommit
419d12ca1b
3 измененных файлов: 25 добавлений и 9 удалений
  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 Просмотреть файл

804
 
804
 
805
 //#define NO_MOTION_BEFORE_HOMING  // Inhibit movement until all axes have been homed
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
 //#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
809
 //#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
808
                              // Be sure you have this distance over your Z_MAX_POS in case.
810
                              // Be sure you have this distance over your Z_MAX_POS in case.
809
 
811
 

+ 8
- 2
Marlin/src/gcode/calibrate/G28.cpp Просмотреть файл

221
 
221
 
222
     #endif
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
       // Raise Z before homing any other axes and z is not already high enough (never lower z)
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
       if (destination[Z_AXIS] > current_position[Z_AXIS]) {
233
       if (destination[Z_AXIS] > current_position[Z_AXIS]) {
228
 
234
 
229
         #if ENABLED(DEBUG_LEVELING_FEATURE)
235
         #if ENABLED(DEBUG_LEVELING_FEATURE)

+ 15
- 7
Marlin/src/module/probe.cpp Просмотреть файл

378
 
378
 
379
   // Make room for probe to deploy (or stow)
379
   // Make room for probe to deploy (or stow)
380
   // Fix-mounted probe should only raise for deploy
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
   #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
397
   #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
390
     #if ENABLED(Z_PROBE_SLED)
398
     #if ENABLED(Z_PROBE_SLED)

Загрузка…
Отмена
Сохранить