Kaynağa Gözat

Merge pull request #4217 from thinkyhead/rc_fix_homing_raise

Don't do_probe_raise with MIN_Z_HEIGHT_FOR_HOMING
Scott Lahteine 9 yıl önce
ebeveyn
işleme
799c60cadc
3 değiştirilmiş dosya ile 98 ekleme ve 88 silme
  1. 4
    7
      Marlin/Conditionals.h
  2. 79
    81
      Marlin/Marlin_main.cpp
  3. 15
    0
      Marlin/SanityCheck.h

+ 4
- 7
Marlin/Conditionals.h Dosyayı Görüntüle

783
         #define XY_PROBE_SPEED 4000
783
         #define XY_PROBE_SPEED 4000
784
       #endif
784
       #endif
785
     #endif
785
     #endif
786
-    #ifndef Z_RAISE_PROBE_DEPLOY_STOW
787
-      #if defined(Z_RAISE_BEFORE_PROBING) && defined(Z_RAISE_AFTER_PROBING)
788
-        #define Z_RAISE_PROBE_DEPLOY_STOW (max(Z_RAISE_BEFORE_PROBING, Z_RAISE_AFTER_PROBING))
789
-      #else
790
-        #error "You must set Z_RAISE_PROBE_DEPLOY_STOW in your configuration."
791
-      #endif
786
+    #if Z_RAISE_BETWEEN_PROBINGS > Z_RAISE_PROBE_DEPLOY_STOW
787
+      #define _Z_RAISE_PROBE_DEPLOY_STOW Z_RAISE_BETWEEN_PROBINGS
788
+    #else
789
+      #define _Z_RAISE_PROBE_DEPLOY_STOW Z_RAISE_PROBE_DEPLOY_STOW
792
     #endif
790
     #endif
793
-    #define _Z_RAISE_PROBE_DEPLOY_STOW (max(Z_RAISE_PROBE_DEPLOY_STOW, Z_RAISE_BETWEEN_PROBINGS))
794
   #endif
791
   #endif
795
 
792
 
796
   /**
793
   /**

+ 79
- 81
Marlin/Marlin_main.cpp Dosyayı Görüntüle

1728
     if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
1728
     if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
1729
       z_dest -= zprobe_zoffset;
1729
       z_dest -= zprobe_zoffset;
1730
 
1730
 
1731
-    if (z_dest > current_position[Z_AXIS]) {
1731
+    if (z_dest > current_position[Z_AXIS])
1732
       do_blocking_move_to_z(z_dest);
1732
       do_blocking_move_to_z(z_dest);
1733
-    }
1734
   }
1733
   }
1735
 
1734
 
1736
 #endif //HAS_BED_PROBE
1735
 #endif //HAS_BED_PROBE
2764
   }
2763
   }
2765
 #endif
2764
 #endif
2766
 
2765
 
2766
+#if ENABLED(QUICK_HOME)
2767
+
2768
+  static void quick_home_xy() {
2769
+
2770
+    current_position[X_AXIS] = current_position[Y_AXIS] = 0;
2771
+
2772
+    #if ENABLED(DUAL_X_CARRIAGE)
2773
+      int x_axis_home_dir = x_home_dir(active_extruder);
2774
+      extruder_duplication_enabled = false;
2775
+    #else
2776
+      int x_axis_home_dir = home_dir(X_AXIS);
2777
+    #endif
2778
+
2779
+    SYNC_PLAN_POSITION_KINEMATIC();
2780
+
2781
+    float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS),
2782
+          mlratio = mlx > mly ? mly / mlx : mlx / mly;
2783
+
2784
+    destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir;
2785
+    destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
2786
+    feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
2787
+    line_to_destination();
2788
+    stepper.synchronize();
2789
+
2790
+    set_axis_is_at_home(X_AXIS);
2791
+    set_axis_is_at_home(Y_AXIS);
2792
+    SYNC_PLAN_POSITION_KINEMATIC();
2793
+
2794
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
2795
+      if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position);
2796
+    #endif
2797
+
2798
+    destination[X_AXIS] = current_position[X_AXIS];
2799
+    destination[Y_AXIS] = current_position[Y_AXIS];
2800
+    line_to_destination();
2801
+    stepper.synchronize();
2802
+    endstops.hit_on_purpose(); // clear endstop hit flags
2803
+
2804
+    current_position[X_AXIS] = destination[X_AXIS];
2805
+    current_position[Y_AXIS] = destination[Y_AXIS];
2806
+    #if DISABLED(SCARA)
2807
+      current_position[Z_AXIS] = destination[Z_AXIS];
2808
+    #endif
2809
+
2810
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
2811
+      if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 2", current_position);
2812
+    #endif
2813
+  }
2814
+
2815
+#endif // QUICK_HOME
2816
+
2767
 /**
2817
 /**
2768
  * G28: Home all axes according to settings
2818
  * G28: Home all axes according to settings
2769
  *
2819
  *
2815
 
2865
 
2816
   setup_for_endstop_move();
2866
   setup_for_endstop_move();
2817
 
2867
 
2818
-  /**
2819
-   * Directly after a reset this is all 0. Later we get a hint if we have
2820
-   * to raise z or not.
2821
-   */
2822
-  set_destination_to_current();
2823
-
2824
   #if ENABLED(DELTA)
2868
   #if ENABLED(DELTA)
2825
     /**
2869
     /**
2826
-     * A delta can only safely home all axis at the same time
2827
-     * all axis have to home at the same time
2870
+     * A delta can only safely home all axes at the same time
2828
      */
2871
      */
2829
 
2872
 
2830
     // Pretend the current position is 0,0,0
2873
     // Pretend the current position is 0,0,0
2860
 
2903
 
2861
     home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
2904
     home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
2862
 
2905
 
2906
+    set_destination_to_current();
2907
+
2863
     #if Z_HOME_DIR > 0  // If homing away from BED do Z first
2908
     #if Z_HOME_DIR > 0  // If homing away from BED do Z first
2864
 
2909
 
2865
       if (home_all_axis || homeZ) {
2910
       if (home_all_axis || homeZ) {
2871
 
2916
 
2872
     #elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
2917
     #elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
2873
 
2918
 
2874
-      #if HAS_BED_PROBE
2875
-        do_probe_raise(MIN_Z_HEIGHT_FOR_HOMING);
2876
-        destination[Z_AXIS] = current_position[Z_AXIS];
2877
-      #else
2878
-        // Raise Z before homing any other axes and z is not already high enough (never lower z)
2879
-        if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
2880
-          destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
2881
-          feedrate = planner.max_feedrate[Z_AXIS] * 60;  // feedrate (mm/m) = max_feedrate (mm/s)
2882
-          #if ENABLED(DEBUG_LEVELING_FEATURE)
2883
-            if (DEBUGGING(LEVELING)) {
2884
-              SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
2885
-              SERIAL_EOL;
2886
-              DEBUG_POS("> (home_all_axis || homeZ)", current_position);
2887
-              DEBUG_POS("> (home_all_axis || homeZ)", destination);
2888
-            }
2889
-          #endif
2890
-          line_to_destination();
2891
-          stepper.synchronize();
2892
-
2893
-          /**
2894
-           * Update the current Z position even if it currently not real from
2895
-           * Z-home otherwise each call to line_to_destination() will want to
2896
-           * move Z-axis by MIN_Z_HEIGHT_FOR_HOMING.
2897
-           */
2898
-          current_position[Z_AXIS] = destination[Z_AXIS];
2919
+      // Raise Z before homing any other axes and z is not already high enough (never lower z)
2920
+      float z_dest = (current_position[Z_AXIS] += MIN_Z_HEIGHT_FOR_HOMING);
2921
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
2922
+        if (DEBUGGING(LEVELING)) {
2923
+          SERIAL_ECHOPAIR("Raise Z (before homing) to ", z_dest);
2924
+          SERIAL_EOL;
2899
         }
2925
         }
2900
       #endif
2926
       #endif
2901
-    #endif
2902
-
2903
-    #if ENABLED(QUICK_HOME)
2904
-
2905
-      if (home_all_axis || (homeX && homeY)) {  // First diagonal move
2906
-
2907
-        current_position[X_AXIS] = current_position[Y_AXIS] = 0;
2908
-
2909
-        #if ENABLED(DUAL_X_CARRIAGE)
2910
-          int x_axis_home_dir = x_home_dir(active_extruder);
2911
-          extruder_duplication_enabled = false;
2912
-        #else
2913
-          int x_axis_home_dir = home_dir(X_AXIS);
2914
-        #endif
2915
 
2927
 
2916
-        SYNC_PLAN_POSITION_KINEMATIC();
2917
-
2918
-        float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS),
2919
-              mlratio = mlx > mly ? mly / mlx : mlx / mly;
2928
+      feedrate = homing_feedrate[Z_AXIS];
2920
 
2929
 
2921
-        destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir;
2922
-        destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
2923
-        feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
2924
-        line_to_destination();
2930
+      #if HAS_BED_PROBE
2931
+        do_blocking_move_to_z(z_dest);
2932
+      #else
2933
+        line_to_z(z_dest);
2925
         stepper.synchronize();
2934
         stepper.synchronize();
2935
+      #endif
2926
 
2936
 
2927
-        set_axis_is_at_home(X_AXIS);
2928
-        set_axis_is_at_home(Y_AXIS);
2929
-        SYNC_PLAN_POSITION_KINEMATIC();
2937
+    #endif // MIN_Z_HEIGHT_FOR_HOMING
2930
 
2938
 
2931
-        #if ENABLED(DEBUG_LEVELING_FEATURE)
2932
-          if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position);
2933
-        #endif
2939
+    #if ENABLED(QUICK_HOME)
2934
 
2940
 
2935
-        destination[X_AXIS] = current_position[X_AXIS];
2936
-        destination[Y_AXIS] = current_position[Y_AXIS];
2937
-        line_to_destination();
2938
-        stepper.synchronize();
2939
-        endstops.hit_on_purpose(); // clear endstop hit flags
2941
+      bool quick_homed = home_all_axis || (homeX && homeY);
2942
+      if (quick_homed) quick_home_xy();
2940
 
2943
 
2941
-        current_position[X_AXIS] = destination[X_AXIS];
2942
-        current_position[Y_AXIS] = destination[Y_AXIS];
2943
-        #if DISABLED(SCARA)
2944
-          current_position[Z_AXIS] = destination[Z_AXIS];
2945
-        #endif
2944
+    #else
2946
 
2945
 
2947
-        #if ENABLED(DEBUG_LEVELING_FEATURE)
2948
-          if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 2", current_position);
2949
-        #endif
2950
-      }
2946
+      const bool quick_homed = false;
2951
 
2947
 
2952
-    #endif // QUICK_HOME
2948
+    #endif
2953
 
2949
 
2954
     #if ENABLED(HOME_Y_BEFORE_X)
2950
     #if ENABLED(HOME_Y_BEFORE_X)
2951
+
2955
       // Home Y
2952
       // Home Y
2956
-      if (home_all_axis || homeY) {
2953
+      if (!quick_homed && (home_all_axis || homeY)) {
2957
         HOMEAXIS(Y);
2954
         HOMEAXIS(Y);
2958
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2955
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2959
           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
2956
           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
2960
         #endif
2957
         #endif
2961
       }
2958
       }
2959
+
2962
     #endif
2960
     #endif
2963
 
2961
 
2964
     // Home X
2962
     // Home X
2965
-    if (home_all_axis || homeX) {
2963
+    if (!quick_homed && (home_all_axis || homeX)) {
2966
       #if ENABLED(DUAL_X_CARRIAGE)
2964
       #if ENABLED(DUAL_X_CARRIAGE)
2967
         int tmp_extruder = active_extruder;
2965
         int tmp_extruder = active_extruder;
2968
         extruder_duplication_enabled = false;
2966
         extruder_duplication_enabled = false;
2985
 
2983
 
2986
     #if DISABLED(HOME_Y_BEFORE_X)
2984
     #if DISABLED(HOME_Y_BEFORE_X)
2987
       // Home Y
2985
       // Home Y
2988
-      if (home_all_axis || homeY) {
2986
+      if (!quick_homed && (home_all_axis || homeY)) {
2989
         HOMEAXIS(Y);
2987
         HOMEAXIS(Y);
2990
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2988
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2991
           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
2989
           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);

+ 15
- 0
Marlin/SanityCheck.h Dosyayı Görüntüle

293
     //#endif
293
     //#endif
294
   #endif
294
   #endif
295
 
295
 
296
+  /**
297
+   * Make sure Z raise values are set
298
+   */
299
+  #if defined(Z_RAISE_BEFORE_PROBING) || defined(Z_RAISE_AFTER_PROBING)
300
+    #error "Z_RAISE_(BEFORE|AFTER)_PROBING are deprecated. Use Z_RAISE_PROBE_DEPLOY_STOW instead."
301
+  #elif !defined(Z_RAISE_PROBE_DEPLOY_STOW)
302
+    #error "You must set Z_RAISE_PROBE_DEPLOY_STOW in your configuration."
303
+  #elif !defined(Z_RAISE_BETWEEN_PROBINGS)
304
+    #error "You must set Z_RAISE_BETWEEN_PROBINGS in your configuration."
305
+  #elif Z_RAISE_PROBE_DEPLOY_STOW < 1
306
+    #error "Probes need Z_RAISE_PROBE_DEPLOY_STOW >= 1."
307
+  #elif Z_RAISE_BETWEEN_PROBINGS < 1
308
+    #error "Probes need Z_RAISE_BETWEEN_PROBINGS >= 1."
309
+  #endif
310
+
296
 #else
311
 #else
297
 
312
 
298
   /**
313
   /**

Loading…
İptal
Kaydet