|
@@ -462,6 +462,7 @@ static uint8_t target_extruder;
|
462
|
462
|
#define TOWER_3 Z_AXIS
|
463
|
463
|
|
464
|
464
|
float delta[3] = { 0 };
|
|
465
|
+ float cartesian[3] = { 0 };
|
465
|
466
|
#define SIN_60 0.8660254037844386
|
466
|
467
|
#define COS_60 0.5
|
467
|
468
|
float endstop_adj[3] = { 0 };
|
|
@@ -2087,9 +2088,9 @@ static void clean_up_after_endstop_or_probe_move() {
|
2087
|
2088
|
}
|
2088
|
2089
|
|
2089
|
2090
|
#if ENABLED(DELTA)
|
2090
|
|
- #define Z_FROM_STEPPERS() z_before + stepper.get_axis_position_mm(Z_AXIS) - z_mm
|
|
2091
|
+ #define SET_Z_FROM_STEPPERS() set_current_from_steppers()
|
2091
|
2092
|
#else
|
2092
|
|
- #define Z_FROM_STEPPERS() stepper.get_axis_position_mm(Z_AXIS)
|
|
2093
|
+ #define SET_Z_FROM_STEPPERS() current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS)
|
2093
|
2094
|
#endif
|
2094
|
2095
|
|
2095
|
2096
|
// Do a single Z probe and return with current_position[Z_AXIS]
|
|
@@ -2110,7 +2111,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2110
|
2111
|
|
2111
|
2112
|
do_blocking_move_to_z(-(Z_MAX_LENGTH + 10), Z_PROBE_SPEED_FAST);
|
2112
|
2113
|
endstops.hit_on_purpose();
|
2113
|
|
- current_position[Z_AXIS] = Z_FROM_STEPPERS();
|
|
2114
|
+ SET_Z_FROM_STEPPERS();
|
2114
|
2115
|
SYNC_PLAN_POSITION_KINEMATIC();
|
2115
|
2116
|
|
2116
|
2117
|
// move up the retract distance
|
|
@@ -2124,7 +2125,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2124
|
2125
|
// move back down slowly to find bed
|
2125
|
2126
|
do_blocking_move_to_z(current_position[Z_AXIS] - home_bump_mm(Z_AXIS) * 2, Z_PROBE_SPEED_SLOW);
|
2126
|
2127
|
endstops.hit_on_purpose();
|
2127
|
|
- current_position[Z_AXIS] = Z_FROM_STEPPERS();
|
|
2128
|
+ SET_Z_FROM_STEPPERS();
|
2128
|
2129
|
SYNC_PLAN_POSITION_KINEMATIC();
|
2129
|
2130
|
|
2130
|
2131
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -7780,7 +7781,6 @@ void clamp_to_software_endstops(float target[3]) {
|
7780
|
7781
|
return abs(distance - delta[TOWER_3]);
|
7781
|
7782
|
}
|
7782
|
7783
|
|
7783
|
|
- float cartesian[3]; // result
|
7784
|
7784
|
void forwardKinematics(float z1, float z2, float z3) {
|
7785
|
7785
|
//As discussed in Wikipedia "Trilateration"
|
7786
|
7786
|
//we are establishing a new coordinate
|
|
@@ -7803,7 +7803,7 @@ void clamp_to_software_endstops(float target[3]) {
|
7803
|
7803
|
|
7804
|
7804
|
// Result is in cartesian[].
|
7805
|
7805
|
|
7806
|
|
- //Create a vector in old coords along x axis of new coord
|
|
7806
|
+ //Create a vector in old coordinates along x axis of new coordinate
|
7807
|
7807
|
float p12[3] = { delta_tower2_x - delta_tower1_x, delta_tower2_y - delta_tower1_y, z2 - z1 };
|
7808
|
7808
|
|
7809
|
7809
|
//Get the Magnitude of vector.
|
|
@@ -7850,6 +7850,23 @@ void clamp_to_software_endstops(float target[3]) {
|
7850
|
7850
|
cartesian[Z_AXIS] = z1 + ex[2]*Xnew + ey[2]*Ynew - ez[2]*Znew;
|
7851
|
7851
|
};
|
7852
|
7852
|
|
|
7853
|
+ void forwardKinematics(float point[3]) {
|
|
7854
|
+ forwardKinematics(point[X_AXIS], point[Y_AXIS], point[Z_AXIS]);
|
|
7855
|
+ }
|
|
7856
|
+
|
|
7857
|
+ void set_cartesian_from_steppers() {
|
|
7858
|
+ forwardKinematics(stepper.get_axis_position_mm(X_AXIS),
|
|
7859
|
+ stepper.get_axis_position_mm(Y_AXIS),
|
|
7860
|
+ stepper.get_axis_position_mm(Z_AXIS));
|
|
7861
|
+ }
|
|
7862
|
+
|
|
7863
|
+ void set_current_from_steppers() {
|
|
7864
|
+ set_cartesian_from_steppers();
|
|
7865
|
+ current_position[X_AXIS] = cartesian[X_AXIS];
|
|
7866
|
+ current_position[Y_AXIS] = cartesian[Y_AXIS];
|
|
7867
|
+ current_position[Z_AXIS] = cartesian[Z_AXIS];
|
|
7868
|
+ }
|
|
7869
|
+
|
7853
|
7870
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
7854
|
7871
|
|
7855
|
7872
|
// Adjust print surface height by linear interpolation over the bed_level array.
|