|
@@ -1594,7 +1594,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1594
|
1594
|
/**
|
1595
|
1595
|
* Some planner shorthand inline functions
|
1596
|
1596
|
*/
|
1597
|
|
-inline void set_homing_bump_feedrate(AxisEnum axis) {
|
|
1597
|
+inline float set_homing_bump_feedrate(AxisEnum axis) {
|
1598
|
1598
|
const int homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
|
1599
|
1599
|
int hbd = homing_bump_divisor[axis];
|
1600
|
1600
|
if (hbd < 1) {
|
|
@@ -1603,6 +1603,7 @@ inline void set_homing_bump_feedrate(AxisEnum axis) {
|
1603
|
1603
|
SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1");
|
1604
|
1604
|
}
|
1605
|
1605
|
feedrate_mm_m = homing_feedrate_mm_m[axis] / hbd;
|
|
1606
|
+ return feedrate_mm_m;
|
1606
|
1607
|
}
|
1607
|
1608
|
//
|
1608
|
1609
|
// line_to_current_position
|
|
@@ -1707,6 +1708,11 @@ static void do_blocking_move_to(float x, float y, float z, float fr_mm_m = 0.0)
|
1707
|
1708
|
feedrate_mm_m = old_feedrate_mm_m;
|
1708
|
1709
|
}
|
1709
|
1710
|
|
|
1711
|
+inline void do_blocking_move_to_axis_pos(AxisEnum axis, float where, float fr_mm_m = 0.0) {
|
|
1712
|
+ current_position[axis] = where;
|
|
1713
|
+ do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_m);
|
|
1714
|
+}
|
|
1715
|
+
|
1710
|
1716
|
inline void do_blocking_move_to_x(float x, float fr_mm_m = 0.0) {
|
1711
|
1717
|
do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_m);
|
1712
|
1718
|
}
|
|
@@ -2419,27 +2425,19 @@ static void homeaxis(AxisEnum axis) {
|
2419
|
2425
|
#endif
|
2420
|
2426
|
|
2421
|
2427
|
// Move towards the endstop until an endstop is triggered
|
2422
|
|
- destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
2423
|
|
- feedrate_mm_m = homing_feedrate_mm_m[axis];
|
2424
|
|
- line_to_destination();
|
2425
|
|
- stepper.synchronize();
|
|
2428
|
+ do_blocking_move_to_axis_pos(axis, 1.5 * max_length(axis) * axis_home_dir, homing_feedrate_mm_m[axis]);
|
2426
|
2429
|
|
2427
|
2430
|
// Set the axis position as setup for the move
|
2428
|
2431
|
current_position[axis] = 0;
|
2429
|
2432
|
sync_plan_position();
|
2430
|
2433
|
|
2431
|
2434
|
// Move away from the endstop by the axis HOME_BUMP_MM
|
2432
|
|
- destination[axis] = -home_bump_mm(axis) * axis_home_dir;
|
2433
|
|
- line_to_destination();
|
2434
|
|
- stepper.synchronize();
|
|
2435
|
+ do_blocking_move_to_axis_pos(axis, -home_bump_mm(axis) * axis_home_dir, homing_feedrate_mm_m[axis]);
|
2435
|
2436
|
|
2436
|
2437
|
// Slow down the feedrate for the next move
|
2437
|
|
- set_homing_bump_feedrate(axis);
|
2438
|
2438
|
|
2439
|
2439
|
// Move slowly towards the endstop until triggered
|
2440
|
|
- destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir;
|
2441
|
|
- line_to_destination();
|
2442
|
|
- stepper.synchronize();
|
|
2440
|
+ do_blocking_move_to_axis_pos(axis, 2 * home_bump_mm(axis) * axis_home_dir, set_homing_bump_feedrate(axis));
|
2443
|
2441
|
|
2444
|
2442
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
2445
|
2443
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> TRIGGER ENDSTOP", current_position);
|
|
@@ -2460,10 +2458,7 @@ static void homeaxis(AxisEnum axis) {
|
2460
|
2458
|
sync_plan_position();
|
2461
|
2459
|
|
2462
|
2460
|
// Move to the adjusted endstop height
|
2463
|
|
- feedrate_mm_m = homing_feedrate_mm_m[axis];
|
2464
|
|
- destination[Z_AXIS] = adj;
|
2465
|
|
- line_to_destination();
|
2466
|
|
- stepper.synchronize();
|
|
2461
|
+ do_blocking_move_to_z(adj, homing_feedrate_mm_m[axis]);
|
2467
|
2462
|
|
2468
|
2463
|
if (lockZ1) stepper.set_z_lock(false); else stepper.set_z2_lock(false);
|
2469
|
2464
|
stepper.set_homing_flag(false);
|
|
@@ -2474,15 +2469,13 @@ static void homeaxis(AxisEnum axis) {
|
2474
|
2469
|
// retrace by the amount specified in endstop_adj
|
2475
|
2470
|
if (endstop_adj[axis] * axis_home_dir < 0) {
|
2476
|
2471
|
sync_plan_position();
|
2477
|
|
- destination[axis] = endstop_adj[axis];
|
2478
|
2472
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
2479
|
2473
|
if (DEBUGGING(LEVELING)) {
|
2480
|
2474
|
SERIAL_ECHOPAIR("> endstop_adj = ", endstop_adj[axis]);
|
2481
|
|
- DEBUG_POS("", destination);
|
|
2475
|
+ DEBUG_POS("", current_position);
|
2482
|
2476
|
}
|
2483
|
2477
|
#endif
|
2484
|
|
- line_to_destination();
|
2485
|
|
- stepper.synchronize();
|
|
2478
|
+ do_blocking_move_to_axis_pos(axis, endstop_adj[axis], set_homing_bump_feedrate(axis));
|
2486
|
2479
|
}
|
2487
|
2480
|
#endif
|
2488
|
2481
|
|
|
@@ -2836,8 +2829,6 @@ inline void gcode_G4() {
|
2836
|
2829
|
|
2837
|
2830
|
static void quick_home_xy() {
|
2838
|
2831
|
|
2839
|
|
- current_position[X_AXIS] = current_position[Y_AXIS] = 0;
|
2840
|
|
-
|
2841
|
2832
|
#if ENABLED(DUAL_X_CARRIAGE)
|
2842
|
2833
|
int x_axis_home_dir = x_home_dir(active_extruder);
|
2843
|
2834
|
extruder_duplication_enabled = false;
|
|
@@ -2845,17 +2836,15 @@ inline void gcode_G4() {
|
2845
|
2836
|
int x_axis_home_dir = home_dir(X_AXIS);
|
2846
|
2837
|
#endif
|
2847
|
2838
|
|
2848
|
|
- float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS),
|
2849
|
|
- mlratio = mlx > mly ? mly / mlx : mlx / mly;
|
|
2839
|
+ float mlx = max_length(X_AXIS),
|
|
2840
|
+ mly = max_length(Y_AXIS),
|
|
2841
|
+ mlratio = mlx > mly ? mly / mlx : mlx / mly,
|
|
2842
|
+ fr_mm_m = min(homing_feedrate_mm_m[X_AXIS], homing_feedrate_mm_m[Y_AXIS]) * sqrt(sq(mlratio) + 1);
|
2850
|
2843
|
|
2851
|
|
- destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir;
|
2852
|
|
- destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
|
2853
|
|
- feedrate_mm_m = min(homing_feedrate_mm_m[X_AXIS], homing_feedrate_mm_m[Y_AXIS]) * sqrt(sq(mlratio) + 1);
|
2854
|
|
- line_to_destination();
|
2855
|
|
- stepper.synchronize();
|
|
2844
|
+ do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_m);
|
2856
|
2845
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
2846
|
+ current_position[X_AXIS] = current_position[Y_AXIS] = 0;
|
2857
|
2847
|
|
2858
|
|
- destination[X_AXIS] = destination[Y_AXIS] = 0;
|
2859
|
2848
|
}
|
2860
|
2849
|
|
2861
|
2850
|
#endif // QUICK_HOME
|