Don't re-home X and Y if you quick homed
This commit is contained in:
		| @@ -2763,6 +2763,57 @@ inline void gcode_G4() { | ||||
|   } | ||||
| #endif | ||||
|  | ||||
| #if ENABLED(QUICK_HOME) | ||||
|  | ||||
|   static void quick_home_xy() { | ||||
|  | ||||
|     current_position[X_AXIS] = current_position[Y_AXIS] = 0; | ||||
|  | ||||
|     #if ENABLED(DUAL_X_CARRIAGE) | ||||
|       int x_axis_home_dir = x_home_dir(active_extruder); | ||||
|       extruder_duplication_enabled = false; | ||||
|     #else | ||||
|       int x_axis_home_dir = home_dir(X_AXIS); | ||||
|     #endif | ||||
|  | ||||
|     SYNC_PLAN_POSITION_KINEMATIC(); | ||||
|  | ||||
|     float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS), | ||||
|           mlratio = mlx > mly ? mly / mlx : mlx / mly; | ||||
|  | ||||
|     destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir; | ||||
|     destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS); | ||||
|     feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1); | ||||
|     line_to_destination(); | ||||
|     stepper.synchronize(); | ||||
|  | ||||
|     set_axis_is_at_home(X_AXIS); | ||||
|     set_axis_is_at_home(Y_AXIS); | ||||
|     SYNC_PLAN_POSITION_KINEMATIC(); | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position); | ||||
|     #endif | ||||
|  | ||||
|     destination[X_AXIS] = current_position[X_AXIS]; | ||||
|     destination[Y_AXIS] = current_position[Y_AXIS]; | ||||
|     line_to_destination(); | ||||
|     stepper.synchronize(); | ||||
|     endstops.hit_on_purpose(); // clear endstop hit flags | ||||
|  | ||||
|     current_position[X_AXIS] = destination[X_AXIS]; | ||||
|     current_position[Y_AXIS] = destination[Y_AXIS]; | ||||
|     #if DISABLED(SCARA) | ||||
|       current_position[Z_AXIS] = destination[Z_AXIS]; | ||||
|     #endif | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 2", current_position); | ||||
|     #endif | ||||
|   } | ||||
|  | ||||
| #endif // QUICK_HOME | ||||
|  | ||||
| /** | ||||
|  * G28: Home all axes according to settings | ||||
|  * | ||||
| @@ -2814,16 +2865,9 @@ inline void gcode_G28() { | ||||
|  | ||||
|   setup_for_endstop_move(); | ||||
|  | ||||
|   /** | ||||
|    * Directly after a reset this is all 0. Later we get a hint if we have | ||||
|    * to raise z or not. | ||||
|    */ | ||||
|   set_destination_to_current(); | ||||
|  | ||||
|   #if ENABLED(DELTA) | ||||
|     /** | ||||
|      * A delta can only safely home all axis at the same time | ||||
|      * all axis have to home at the same time | ||||
|      * A delta can only safely home all axes at the same time | ||||
|      */ | ||||
|  | ||||
|     // Pretend the current position is 0,0,0 | ||||
| @@ -2894,67 +2938,29 @@ inline void gcode_G28() { | ||||
|  | ||||
|     #if ENABLED(QUICK_HOME) | ||||
|  | ||||
|       if (home_all_axis || (homeX && homeY)) {  // First diagonal move | ||||
|       bool quick_homed = home_all_axis || (homeX && homeY); | ||||
|       if (quick_homed) quick_home_xy(); | ||||
|  | ||||
|         current_position[X_AXIS] = current_position[Y_AXIS] = 0; | ||||
|     #else | ||||
|  | ||||
|         #if ENABLED(DUAL_X_CARRIAGE) | ||||
|           int x_axis_home_dir = x_home_dir(active_extruder); | ||||
|           extruder_duplication_enabled = false; | ||||
|         #else | ||||
|           int x_axis_home_dir = home_dir(X_AXIS); | ||||
|         #endif | ||||
|       const bool quick_homed = false; | ||||
|  | ||||
|         SYNC_PLAN_POSITION_KINEMATIC(); | ||||
|  | ||||
|         float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS), | ||||
|               mlratio = mlx > mly ? mly / mlx : mlx / mly; | ||||
|  | ||||
|         destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir; | ||||
|         destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS); | ||||
|         feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1); | ||||
|         line_to_destination(); | ||||
|         stepper.synchronize(); | ||||
|  | ||||
|         set_axis_is_at_home(X_AXIS); | ||||
|         set_axis_is_at_home(Y_AXIS); | ||||
|         SYNC_PLAN_POSITION_KINEMATIC(); | ||||
|  | ||||
|         #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|           if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position); | ||||
|         #endif | ||||
|  | ||||
|         destination[X_AXIS] = current_position[X_AXIS]; | ||||
|         destination[Y_AXIS] = current_position[Y_AXIS]; | ||||
|         line_to_destination(); | ||||
|         stepper.synchronize(); | ||||
|         endstops.hit_on_purpose(); // clear endstop hit flags | ||||
|  | ||||
|         current_position[X_AXIS] = destination[X_AXIS]; | ||||
|         current_position[Y_AXIS] = destination[Y_AXIS]; | ||||
|         #if DISABLED(SCARA) | ||||
|           current_position[Z_AXIS] = destination[Z_AXIS]; | ||||
|         #endif | ||||
|  | ||||
|         #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|           if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 2", current_position); | ||||
|         #endif | ||||
|       } | ||||
|  | ||||
|     #endif // QUICK_HOME | ||||
|     #endif | ||||
|  | ||||
|     #if ENABLED(HOME_Y_BEFORE_X) | ||||
|  | ||||
|       // Home Y | ||||
|       if (home_all_axis || homeY) { | ||||
|       if (!quick_homed && (home_all_axis || homeY)) { | ||||
|         HOMEAXIS(Y); | ||||
|         #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position); | ||||
|         #endif | ||||
|       } | ||||
|  | ||||
|     #endif | ||||
|  | ||||
|     // Home X | ||||
|     if (home_all_axis || homeX) { | ||||
|     if (!quick_homed && (home_all_axis || homeX)) { | ||||
|       #if ENABLED(DUAL_X_CARRIAGE) | ||||
|         int tmp_extruder = active_extruder; | ||||
|         extruder_duplication_enabled = false; | ||||
| @@ -2977,7 +2983,7 @@ inline void gcode_G28() { | ||||
|  | ||||
|     #if DISABLED(HOME_Y_BEFORE_X) | ||||
|       // Home Y | ||||
|       if (home_all_axis || homeY) { | ||||
|       if (!quick_homed && (home_all_axis || homeY)) { | ||||
|         HOMEAXIS(Y); | ||||
|         #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user