|
@@ -458,45 +458,51 @@ static uint8_t target_extruder;
|
458
|
458
|
|
459
|
459
|
#if ENABLED(DELTA)
|
460
|
460
|
|
461
|
|
- #define TOWER_1 X_AXIS
|
462
|
|
- #define TOWER_2 Y_AXIS
|
463
|
|
- #define TOWER_3 Z_AXIS
|
464
|
|
-
|
465
|
|
- float delta[ABC];
|
466
|
|
- float cartesian_position[XYZ] = { 0 };
|
467
|
461
|
#define SIN_60 0.8660254037844386
|
468
|
462
|
#define COS_60 0.5
|
469
|
|
- float endstop_adj[ABC] = { 0 };
|
|
463
|
+
|
|
464
|
+ float delta[ABC],
|
|
465
|
+ cartesian_position[XYZ] = { 0 },
|
|
466
|
+ endstop_adj[ABC] = { 0 };
|
|
467
|
+
|
470
|
468
|
// these are the default values, can be overriden with M665
|
471
|
|
- float delta_radius = DELTA_RADIUS;
|
472
|
|
- float delta_tower1_x = -SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1); // front left tower
|
473
|
|
- float delta_tower1_y = -COS_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1);
|
474
|
|
- float delta_tower2_x = SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2); // front right tower
|
475
|
|
- float delta_tower2_y = -COS_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2);
|
476
|
|
- float delta_tower3_x = 0; // back middle tower
|
477
|
|
- float delta_tower3_y = (delta_radius + DELTA_RADIUS_TRIM_TOWER_3);
|
478
|
|
- float delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
479
|
|
- float delta_diagonal_rod_trim_tower_1 = DELTA_DIAGONAL_ROD_TRIM_TOWER_1;
|
480
|
|
- float delta_diagonal_rod_trim_tower_2 = DELTA_DIAGONAL_ROD_TRIM_TOWER_2;
|
481
|
|
- float delta_diagonal_rod_trim_tower_3 = DELTA_DIAGONAL_ROD_TRIM_TOWER_3;
|
482
|
|
- float delta_diagonal_rod_2_tower_1 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_1);
|
483
|
|
- float delta_diagonal_rod_2_tower_2 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_2);
|
484
|
|
- float delta_diagonal_rod_2_tower_3 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_3);
|
485
|
|
- float delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
|
486
|
|
- float delta_clip_start_height = Z_MAX_POS;
|
|
469
|
+ float delta_radius = DELTA_RADIUS,
|
|
470
|
+ delta_tower1_x = -SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1), // front left tower
|
|
471
|
+ delta_tower1_y = -COS_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1),
|
|
472
|
+ delta_tower2_x = SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2), // front right tower
|
|
473
|
+ delta_tower2_y = -COS_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2),
|
|
474
|
+ delta_tower3_x = 0, // back middle tower
|
|
475
|
+ delta_tower3_y = (delta_radius + DELTA_RADIUS_TRIM_TOWER_3),
|
|
476
|
+ delta_diagonal_rod = DELTA_DIAGONAL_ROD,
|
|
477
|
+ delta_diagonal_rod_trim_tower_1 = DELTA_DIAGONAL_ROD_TRIM_TOWER_1,
|
|
478
|
+ delta_diagonal_rod_trim_tower_2 = DELTA_DIAGONAL_ROD_TRIM_TOWER_2,
|
|
479
|
+ delta_diagonal_rod_trim_tower_3 = DELTA_DIAGONAL_ROD_TRIM_TOWER_3,
|
|
480
|
+ delta_diagonal_rod_2_tower_1 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_1),
|
|
481
|
+ delta_diagonal_rod_2_tower_2 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_2),
|
|
482
|
+ delta_diagonal_rod_2_tower_3 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_3),
|
|
483
|
+ delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND,
|
|
484
|
+ delta_clip_start_height = Z_MAX_POS;
|
|
485
|
+
|
487
|
486
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
488
|
487
|
int delta_grid_spacing[2] = { 0, 0 };
|
489
|
488
|
float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS];
|
490
|
489
|
#endif
|
|
490
|
+
|
491
|
491
|
float delta_safe_distance_from_top();
|
|
492
|
+ void set_cartesian_from_steppers();
|
|
493
|
+
|
492
|
494
|
#else
|
|
495
|
+
|
493
|
496
|
static bool home_all_axis = true;
|
|
497
|
+
|
494
|
498
|
#endif
|
495
|
499
|
|
496
|
500
|
#if ENABLED(SCARA)
|
497
|
|
- float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND;
|
498
|
|
- float delta[ABC];
|
499
|
|
- float axis_scaling[ABC] = { 1, 1, 1 }; // Build size scaling, default to 1
|
|
501
|
+ float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND,
|
|
502
|
+ delta[ABC],
|
|
503
|
+ axis_scaling[ABC] = { 1, 1, 1 }, // Build size scaling, default to 1
|
|
504
|
+ cartesian_position[XYZ] = { 0 };
|
|
505
|
+ void set_cartesian_from_steppers() { } // to be written later
|
500
|
506
|
#endif
|
501
|
507
|
|
502
|
508
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
|
@@ -2266,79 +2272,37 @@ static void clean_up_after_endstop_or_probe_move() {
|
2266
|
2272
|
|
2267
|
2273
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
2268
|
2274
|
|
2269
|
|
- #if ENABLED(AUTO_BED_LEVELING_GRID)
|
2270
|
|
-
|
2271
|
|
- #if DISABLED(DELTA)
|
2272
|
|
-
|
2273
|
|
- static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
|
2274
|
|
-
|
2275
|
|
- //planner.bed_level_matrix.debug("bed level before");
|
2276
|
|
-
|
2277
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2278
|
|
- planner.bed_level_matrix.set_to_identity();
|
2279
|
|
- if (DEBUGGING(LEVELING)) {
|
2280
|
|
- vector_3 uncorrected_position = planner.adjusted_position();
|
2281
|
|
- DEBUG_POS(">>> set_bed_level_equation_lsq", uncorrected_position);
|
2282
|
|
- DEBUG_POS(">>> set_bed_level_equation_lsq", current_position);
|
2283
|
|
- }
|
2284
|
|
- #endif
|
2285
|
|
-
|
2286
|
|
- vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
2287
|
|
- planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
2288
|
|
-
|
2289
|
|
- vector_3 corrected_position = planner.adjusted_position();
|
2290
|
|
- current_position[X_AXIS] = corrected_position.x;
|
2291
|
|
- current_position[Y_AXIS] = corrected_position.y;
|
2292
|
|
- current_position[Z_AXIS] = corrected_position.z;
|
|
2275
|
+ #if DISABLED(DELTA)
|
2293
|
2276
|
|
2294
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2295
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
|
2296
|
|
- #endif
|
2297
|
|
-
|
2298
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
2299
|
|
- }
|
2300
|
|
-
|
2301
|
|
- #endif // !DELTA
|
2302
|
|
-
|
2303
|
|
- #else // !AUTO_BED_LEVELING_GRID
|
2304
|
|
-
|
2305
|
|
- static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
2306
|
|
-
|
2307
|
|
- planner.bed_level_matrix.set_to_identity();
|
|
2277
|
+ /**
|
|
2278
|
+ * Get the stepper positions, apply the rotation matrix
|
|
2279
|
+ * using the home XY and Z0 position as the fulcrum.
|
|
2280
|
+ */
|
|
2281
|
+ vector_3 untilted_stepper_position() {
|
|
2282
|
+ vector_3 pos = vector_3(
|
|
2283
|
+ RAW_X_POSITION(stepper.get_axis_position_mm(X_AXIS)) - X_TILT_FULCRUM,
|
|
2284
|
+ RAW_Y_POSITION(stepper.get_axis_position_mm(Y_AXIS)) - Y_TILT_FULCRUM,
|
|
2285
|
+ RAW_Z_POSITION(stepper.get_axis_position_mm(Z_AXIS))
|
|
2286
|
+ );
|
2308
|
2287
|
|
2309
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2310
|
|
- if (DEBUGGING(LEVELING)) {
|
2311
|
|
- vector_3 uncorrected_position = planner.adjusted_position();
|
2312
|
|
- DEBUG_POS("set_bed_level_equation_3pts", uncorrected_position);
|
2313
|
|
- }
|
2314
|
|
- #endif
|
|
2288
|
+ matrix_3x3 inverse = matrix_3x3::transpose(planner.bed_level_matrix);
|
2315
|
2289
|
|
2316
|
|
- vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
2317
|
|
- vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
2318
|
|
- vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
|
2319
|
|
- vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal();
|
|
2290
|
+ //pos.debug("untilted_stepper_position offset");
|
|
2291
|
+ //bed_level_matrix.debug("untilted_stepper_position");
|
|
2292
|
+ //inverse.debug("in untilted_stepper_position");
|
2320
|
2293
|
|
2321
|
|
- if (planeNormal.z < 0) {
|
2322
|
|
- planeNormal.x = -planeNormal.x;
|
2323
|
|
- planeNormal.y = -planeNormal.y;
|
2324
|
|
- planeNormal.z = -planeNormal.z;
|
2325
|
|
- }
|
|
2294
|
+ pos.apply_rotation(inverse);
|
2326
|
2295
|
|
2327
|
|
- planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
2328
|
|
- vector_3 corrected_position = planner.adjusted_position();
|
|
2296
|
+ pos.x = LOGICAL_X_POSITION(pos.x + X_TILT_FULCRUM);
|
|
2297
|
+ pos.y = LOGICAL_Y_POSITION(pos.y + Y_TILT_FULCRUM);
|
|
2298
|
+ pos.z = LOGICAL_Z_POSITION(pos.z);
|
2329
|
2299
|
|
2330
|
|
- current_position[X_AXIS] = corrected_position.x;
|
2331
|
|
- current_position[Y_AXIS] = corrected_position.y;
|
2332
|
|
- current_position[Z_AXIS] = corrected_position.z;
|
|
2300
|
+ //pos.debug("after rotation and reorientation");
|
2333
|
2301
|
|
2334
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2335
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
|
2336
|
|
- #endif
|
2337
|
|
-
|
2338
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
|
2302
|
+ return pos;
|
2339
|
2303
|
}
|
2340
|
2304
|
|
2341
|
|
- #endif // !AUTO_BED_LEVELING_GRID
|
|
2305
|
+ #endif // !DELTA
|
2342
|
2306
|
|
2343
|
2307
|
#if ENABLED(DELTA)
|
2344
|
2308
|
|
|
@@ -3626,41 +3590,41 @@ inline void gcode_G28() {
|
3626
|
3590
|
|
3627
|
3591
|
#endif // AUTO_BED_LEVELING_GRID
|
3628
|
3592
|
|
3629
|
|
- if (!dryrun) {
|
|
3593
|
+ stepper.synchronize();
|
3630
|
3594
|
|
3631
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(DELTA)
|
3632
|
|
- if (DEBUGGING(LEVELING)) {
|
3633
|
|
- vector_3 corrected_position = planner.adjusted_position();
|
3634
|
|
- DEBUG_POS("BEFORE matrix.set_to_identity", corrected_position);
|
3635
|
|
- DEBUG_POS("BEFORE matrix.set_to_identity", current_position);
|
3636
|
|
- }
|
3637
|
|
- #endif
|
|
3595
|
+ if (!dryrun) {
|
3638
|
3596
|
|
3639
|
|
- // make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
|
|
3597
|
+ // Reset the bed_level_matrix because leveling
|
|
3598
|
+ // needs to be done without leveling enabled.
|
3640
|
3599
|
planner.bed_level_matrix.set_to_identity();
|
3641
|
3600
|
|
3642
|
|
- #if ENABLED(DELTA)
|
3643
|
|
- reset_bed_level();
|
3644
|
|
- #else //!DELTA
|
3645
|
|
-
|
3646
|
|
- //vector_3 corrected_position = planner.adjusted_position();
|
3647
|
|
- //corrected_position.debug("position before G29");
|
3648
|
|
- vector_3 uncorrected_position = planner.adjusted_position();
|
3649
|
|
- //uncorrected_position.debug("position during G29");
|
3650
|
|
- current_position[X_AXIS] = uncorrected_position.x;
|
3651
|
|
- current_position[Y_AXIS] = uncorrected_position.y;
|
3652
|
|
- current_position[Z_AXIS] = uncorrected_position.z;
|
|
3601
|
+ //
|
|
3602
|
+ // Re-orient the current position without leveling
|
|
3603
|
+ // based on where the steppers are positioned.
|
|
3604
|
+ //
|
|
3605
|
+ #if ENABLED(DELTA) || ENABLED(SCARA)
|
3653
|
3606
|
|
3654
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
3655
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("AFTER matrix.set_to_identity", uncorrected_position);
|
|
3607
|
+ #if ENABLED(DELTA)
|
|
3608
|
+ reset_bed_level();
|
3656
|
3609
|
#endif
|
3657
|
3610
|
|
3658
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
|
3611
|
+ // For DELTA/SCARA we need to apply forward kinematics.
|
|
3612
|
+ // This returns raw positions and we remap to the space.
|
|
3613
|
+ set_cartesian_from_steppers();
|
|
3614
|
+ LOOP_XYZ(i) current_position[i] = LOGICAL_POSITION(cartesian_position[i], i);
|
|
3615
|
+
|
|
3616
|
+ #else
|
|
3617
|
+
|
|
3618
|
+ // For cartesian/core the steppers are already mapped to
|
|
3619
|
+ // the coordinate space by design.
|
|
3620
|
+ LOOP_XYZ(i) current_position[i] = stepper.get_axis_position_mm((AxisEnum)i);
|
3659
|
3621
|
|
3660
|
3622
|
#endif // !DELTA
|
3661
|
|
- }
|
3662
|
3623
|
|
3663
|
|
- stepper.synchronize();
|
|
3624
|
+ // Inform the planner about the new coordinates
|
|
3625
|
+ // (This is probably not needed here)
|
|
3626
|
+ SYNC_PLAN_POSITION_KINEMATIC();
|
|
3627
|
+ }
|
3664
|
3628
|
|
3665
|
3629
|
setup_for_endstop_or_probe_move();
|
3666
|
3630
|
|
|
@@ -3766,7 +3730,20 @@ inline void gcode_G28() {
|
3766
|
3730
|
LOGICAL_Y_POSITION(ABL_PROBE_PT_3_Y),
|
3767
|
3731
|
stow_probe_after_each, verbose_level);
|
3768
|
3732
|
|
3769
|
|
- if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
|
3733
|
+ if (!dryrun) {
|
|
3734
|
+ vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1),
|
|
3735
|
+ pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2),
|
|
3736
|
+ pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
|
|
3737
|
+
|
|
3738
|
+ vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal();
|
|
3739
|
+
|
|
3740
|
+ if (planeNormal.z < 0) {
|
|
3741
|
+ planeNormal.x *= -1;
|
|
3742
|
+ planeNormal.y *= -1;
|
|
3743
|
+ planeNormal.z *= -1;
|
|
3744
|
+ }
|
|
3745
|
+ planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
3746
|
+ }
|
3770
|
3747
|
|
3771
|
3748
|
#endif // !AUTO_BED_LEVELING_GRID
|
3772
|
3749
|
|
|
@@ -3810,7 +3787,12 @@ inline void gcode_G28() {
|
3810
|
3787
|
}
|
3811
|
3788
|
}
|
3812
|
3789
|
|
3813
|
|
- if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients);
|
|
3790
|
+ // Create the matrix but don't correct the position yet
|
|
3791
|
+ if (!dryrun) {
|
|
3792
|
+ planner.bed_level_matrix = matrix_3x3::create_look_at(
|
|
3793
|
+ vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1)
|
|
3794
|
+ );
|
|
3795
|
+ }
|
3814
|
3796
|
|
3815
|
3797
|
// Show the Topography map if enabled
|
3816
|
3798
|
if (do_topography_map) {
|
|
@@ -3851,6 +3833,7 @@ inline void gcode_G28() {
|
3851
|
3833
|
SERIAL_EOL;
|
3852
|
3834
|
} // yy
|
3853
|
3835
|
SERIAL_EOL;
|
|
3836
|
+
|
3854
|
3837
|
if (verbose_level > 3) {
|
3855
|
3838
|
SERIAL_PROTOCOLLNPGM("\nCorrected Bed Height vs. Bed Topology:");
|
3856
|
3839
|
|
|
@@ -3876,47 +3859,60 @@ inline void gcode_G28() {
|
3876
|
3859
|
SERIAL_EOL;
|
3877
|
3860
|
}
|
3878
|
3861
|
} //do_topography_map
|
|
3862
|
+
|
3879
|
3863
|
#endif //!DELTA
|
|
3864
|
+
|
3880
|
3865
|
#endif // AUTO_BED_LEVELING_GRID
|
3881
|
3866
|
|
3882
|
3867
|
#if DISABLED(DELTA)
|
|
3868
|
+
|
3883
|
3869
|
if (verbose_level > 0)
|
3884
|
3870
|
planner.bed_level_matrix.debug("\n\nBed Level Correction Matrix:");
|
3885
|
3871
|
|
3886
|
3872
|
if (!dryrun) {
|
3887
|
|
- /**
|
3888
|
|
- * Correct the Z height difference from Z probe position and nozzle tip position.
|
3889
|
|
- * The Z height on homing is measured by Z probe, but the Z probe is quite far
|
3890
|
|
- * from the nozzle. When the bed is uneven, this height must be corrected.
|
3891
|
|
- */
|
3892
|
|
- float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
3893
|
|
- y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
3894
|
|
- z_tmp = current_position[Z_AXIS],
|
3895
|
|
- stepper_z = stepper.get_axis_position_mm(Z_AXIS); //get the real Z (since planner.adjusted_position is now correcting the plane)
|
|
3873
|
+ //
|
|
3874
|
+ // Correct the current XYZ position based on the tilted plane.
|
|
3875
|
+ //
|
|
3876
|
+
|
|
3877
|
+ // Get the distance from the reference point to the current position
|
|
3878
|
+ // The current XY is in sync with the planner/steppers at this point
|
|
3879
|
+ // but the current Z is only known to the steppers.
|
|
3880
|
+ float x_dist = RAW_CURRENT_POSITION(X_AXIS) - X_TILT_FULCRUM,
|
|
3881
|
+ y_dist = RAW_CURRENT_POSITION(Y_AXIS) - Y_TILT_FULCRUM,
|
|
3882
|
+ z_real = RAW_Z_POSITION(stepper.get_axis_position_mm(Z_AXIS));
|
3896
|
3883
|
|
3897
|
3884
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3898
|
3885
|
if (DEBUGGING(LEVELING)) {
|
3899
|
|
- SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > stepper_z = ", stepper_z);
|
3900
|
|
- SERIAL_ECHOLNPAIR(" ... z_tmp = ", z_tmp);
|
|
3886
|
+ SERIAL_ECHOPAIR("BEFORE ROTATION ... x_dist:", x_dist);
|
|
3887
|
+ SERIAL_ECHOPAIR("y_dist:", y_dist);
|
|
3888
|
+ SERIAL_ECHOPAIR("z_real:", z_real);
|
3901
|
3889
|
}
|
3902
|
3890
|
#endif
|
3903
|
3891
|
|
3904
|
|
- // Apply the correction sending the Z probe offset
|
3905
|
|
- apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
3892
|
+ // Apply the matrix to the distance from the reference point to XY,
|
|
3893
|
+ // and from the homed Z to the current Z.
|
|
3894
|
+ apply_rotation_xyz(planner.bed_level_matrix, x_dist, y_dist, z_real);
|
3906
|
3895
|
|
3907
|
3896
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3908
|
|
- if (DEBUGGING(LEVELING))
|
3909
|
|
- SERIAL_ECHOLNPAIR("> AFTER apply_rotation_xyz > z_tmp = ", z_tmp);
|
|
3897
|
+ if (DEBUGGING(LEVELING)) {
|
|
3898
|
+ SERIAL_ECHOPAIR("AFTER ROTATION ... x_dist:", x_dist);
|
|
3899
|
+ SERIAL_ECHOPAIR("y_dist:", y_dist);
|
|
3900
|
+ SERIAL_ECHOPAIR("z_real:", z_real);
|
|
3901
|
+ }
|
3910
|
3902
|
#endif
|
3911
|
3903
|
|
3912
|
|
- // Adjust the current Z and send it to the planner.
|
3913
|
|
- current_position[Z_AXIS] += z_tmp - stepper_z;
|
|
3904
|
+ // Apply the rotated distance and Z to the current position
|
|
3905
|
+ current_position[X_AXIS] = LOGICAL_X_POSITION(X_TILT_FULCRUM + x_dist);
|
|
3906
|
+ current_position[Y_AXIS] = LOGICAL_Y_POSITION(Y_TILT_FULCRUM + y_dist);
|
|
3907
|
+ current_position[Z_AXIS] = LOGICAL_Z_POSITION(z_real);
|
|
3908
|
+
|
3914
|
3909
|
SYNC_PLAN_POSITION_KINEMATIC();
|
3915
|
3910
|
|
3916
|
3911
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3917
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
|
|
3912
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected XYZ in G29", current_position);
|
3918
|
3913
|
#endif
|
3919
|
3914
|
}
|
|
3915
|
+
|
3920
|
3916
|
#endif // !DELTA
|
3921
|
3917
|
|
3922
|
3918
|
#ifdef Z_PROBE_END_SCRIPT
|
|
@@ -7850,15 +7846,15 @@ void ok_to_send() {
|
7850
|
7846
|
RAW_Z_POSITION(in_cartesian[Z_AXIS])
|
7851
|
7847
|
};
|
7852
|
7848
|
|
7853
|
|
- delta[TOWER_1] = sqrt(delta_diagonal_rod_2_tower_1
|
|
7849
|
+ delta[A_AXIS] = sqrt(delta_diagonal_rod_2_tower_1
|
7854
|
7850
|
- sq(delta_tower1_x - cartesian[X_AXIS])
|
7855
|
7851
|
- sq(delta_tower1_y - cartesian[Y_AXIS])
|
7856
|
7852
|
) + cartesian[Z_AXIS];
|
7857
|
|
- delta[TOWER_2] = sqrt(delta_diagonal_rod_2_tower_2
|
|
7853
|
+ delta[B_AXIS] = sqrt(delta_diagonal_rod_2_tower_2
|
7858
|
7854
|
- sq(delta_tower2_x - cartesian[X_AXIS])
|
7859
|
7855
|
- sq(delta_tower2_y - cartesian[Y_AXIS])
|
7860
|
7856
|
) + cartesian[Z_AXIS];
|
7861
|
|
- delta[TOWER_3] = sqrt(delta_diagonal_rod_2_tower_3
|
|
7857
|
+ delta[C_AXIS] = sqrt(delta_diagonal_rod_2_tower_3
|
7862
|
7858
|
- sq(delta_tower3_x - cartesian[X_AXIS])
|
7863
|
7859
|
- sq(delta_tower3_y - cartesian[Y_AXIS])
|
7864
|
7860
|
) + cartesian[Z_AXIS];
|
|
@@ -7867,9 +7863,9 @@ void ok_to_send() {
|
7867
|
7863
|
SERIAL_ECHOPGM(" y="); SERIAL_ECHO(cartesian[Y_AXIS]);
|
7868
|
7864
|
SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(cartesian[Z_AXIS]);
|
7869
|
7865
|
|
7870
|
|
- SERIAL_ECHOPGM("delta a="); SERIAL_ECHO(delta[TOWER_1]);
|
7871
|
|
- SERIAL_ECHOPGM(" b="); SERIAL_ECHO(delta[TOWER_2]);
|
7872
|
|
- SERIAL_ECHOPGM(" c="); SERIAL_ECHOLN(delta[TOWER_3]);
|
|
7866
|
+ SERIAL_ECHOPGM("delta a="); SERIAL_ECHO(delta[A_AXIS]);
|
|
7867
|
+ SERIAL_ECHOPGM(" b="); SERIAL_ECHO(delta[B_AXIS]);
|
|
7868
|
+ SERIAL_ECHOPGM(" c="); SERIAL_ECHOLN(delta[C_AXIS]);
|
7873
|
7869
|
*/
|
7874
|
7870
|
}
|
7875
|
7871
|
|
|
@@ -7880,10 +7876,10 @@ void ok_to_send() {
|
7880
|
7876
|
LOGICAL_Z_POSITION(0)
|
7881
|
7877
|
};
|
7882
|
7878
|
inverse_kinematics(cartesian);
|
7883
|
|
- float distance = delta[TOWER_3];
|
|
7879
|
+ float distance = delta[A_AXIS];
|
7884
|
7880
|
cartesian[Y_AXIS] = LOGICAL_Y_POSITION(DELTA_PRINTABLE_RADIUS);
|
7885
|
7881
|
inverse_kinematics(cartesian);
|
7886
|
|
- return abs(distance - delta[TOWER_3]);
|
|
7882
|
+ return abs(distance - delta[A_AXIS]);
|
7887
|
7883
|
}
|
7888
|
7884
|
|
7889
|
7885
|
void forward_kinematics_DELTA(float z1, float z2, float z3) {
|
|
@@ -8014,7 +8010,7 @@ void set_current_from_steppers_for_axis(AxisEnum axis) {
|
8014
|
8010
|
set_cartesian_from_steppers();
|
8015
|
8011
|
current_position[axis] = LOGICAL_POSITION(cartesian_position[axis], axis);
|
8016
|
8012
|
#elif ENABLED(AUTO_BED_LEVELING_FEATURE)
|
8017
|
|
- vector_3 pos = planner.adjusted_position();
|
|
8013
|
+ vector_3 pos = untilted_stepper_position();
|
8018
|
8014
|
current_position[axis] = axis == X_AXIS ? pos.x : axis == Y_AXIS ? pos.y : pos.z;
|
8019
|
8015
|
#else
|
8020
|
8016
|
current_position[axis] = stepper.get_axis_position_mm(axis); // CORE handled transparently
|