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

Don't re-home X and Y if you quick homed

Scott Lahteine 9 лет назад
Родитель
Сommit
d0b29cabf3
1 измененных файлов: 62 добавлений и 56 удалений
  1. 62
    56
      Marlin/Marlin_main.cpp

+ 62
- 56
Marlin/Marlin_main.cpp Просмотреть файл

@@ -2763,6 +2763,57 @@ inline void gcode_G4() {
2763 2763
   }
2764 2764
 #endif
2765 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
+
2766 2817
 /**
2767 2818
  * G28: Home all axes according to settings
2768 2819
  *
@@ -2814,16 +2865,9 @@ inline void gcode_G28() {
2814 2865
 
2815 2866
   setup_for_endstop_move();
2816 2867
 
2817
-  /**
2818
-   * Directly after a reset this is all 0. Later we get a hint if we have
2819
-   * to raise z or not.
2820
-   */
2821
-  set_destination_to_current();
2822
-
2823 2868
   #if ENABLED(DELTA)
2824 2869
     /**
2825
-     * A delta can only safely home all axis at the same time
2826
-     * all axis have to home at the same time
2870
+     * A delta can only safely home all axes at the same time
2827 2871
      */
2828 2872
 
2829 2873
     // Pretend the current position is 0,0,0
@@ -2894,67 +2938,29 @@ inline void gcode_G28() {
2894 2938
 
2895 2939
     #if ENABLED(QUICK_HOME)
2896 2940
 
2897
-      if (home_all_axis || (homeX && homeY)) {  // First diagonal move
2898
-
2899
-        current_position[X_AXIS] = current_position[Y_AXIS] = 0;
2900
-
2901
-        #if ENABLED(DUAL_X_CARRIAGE)
2902
-          int x_axis_home_dir = x_home_dir(active_extruder);
2903
-          extruder_duplication_enabled = false;
2904
-        #else
2905
-          int x_axis_home_dir = home_dir(X_AXIS);
2906
-        #endif
2907
-
2908
-        SYNC_PLAN_POSITION_KINEMATIC();
2909
-
2910
-        float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS),
2911
-              mlratio = mlx > mly ? mly / mlx : mlx / mly;
2912
-
2913
-        destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir;
2914
-        destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
2915
-        feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
2916
-        line_to_destination();
2917
-        stepper.synchronize();
2918
-
2919
-        set_axis_is_at_home(X_AXIS);
2920
-        set_axis_is_at_home(Y_AXIS);
2921
-        SYNC_PLAN_POSITION_KINEMATIC();
2922
-
2923
-        #if ENABLED(DEBUG_LEVELING_FEATURE)
2924
-          if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position);
2925
-        #endif
2926
-
2927
-        destination[X_AXIS] = current_position[X_AXIS];
2928
-        destination[Y_AXIS] = current_position[Y_AXIS];
2929
-        line_to_destination();
2930
-        stepper.synchronize();
2931
-        endstops.hit_on_purpose(); // clear endstop hit flags
2941
+      bool quick_homed = home_all_axis || (homeX && homeY);
2942
+      if (quick_homed) quick_home_xy();
2932 2943
 
2933
-        current_position[X_AXIS] = destination[X_AXIS];
2934
-        current_position[Y_AXIS] = destination[Y_AXIS];
2935
-        #if DISABLED(SCARA)
2936
-          current_position[Z_AXIS] = destination[Z_AXIS];
2937
-        #endif
2944
+    #else
2938 2945
 
2939
-        #if ENABLED(DEBUG_LEVELING_FEATURE)
2940
-          if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 2", current_position);
2941
-        #endif
2942
-      }
2946
+      const bool quick_homed = false;
2943 2947
 
2944
-    #endif // QUICK_HOME
2948
+    #endif
2945 2949
 
2946 2950
     #if ENABLED(HOME_Y_BEFORE_X)
2951
+
2947 2952
       // Home Y
2948
-      if (home_all_axis || homeY) {
2953
+      if (!quick_homed && (home_all_axis || homeY)) {
2949 2954
         HOMEAXIS(Y);
2950 2955
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2951 2956
           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
2952 2957
         #endif
2953 2958
       }
2959
+
2954 2960
     #endif
2955 2961
 
2956 2962
     // Home X
2957
-    if (home_all_axis || homeX) {
2963
+    if (!quick_homed && (home_all_axis || homeX)) {
2958 2964
       #if ENABLED(DUAL_X_CARRIAGE)
2959 2965
         int tmp_extruder = active_extruder;
2960 2966
         extruder_duplication_enabled = false;
@@ -2977,7 +2983,7 @@ inline void gcode_G28() {
2977 2983
 
2978 2984
     #if DISABLED(HOME_Y_BEFORE_X)
2979 2985
       // Home Y
2980
-      if (home_all_axis || homeY) {
2986
+      if (!quick_homed && (home_all_axis || homeY)) {
2981 2987
         HOMEAXIS(Y);
2982 2988
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2983 2989
           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);

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