From 46cc2e3f6ae7ec4d3cb4675aaa23274d021eb5fa Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 15 Sep 2016 15:07:14 -0500 Subject: [PATCH] Fix get_cartesian_from_steppers --- Marlin/Marlin_main.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index d01b1c1db0..035b33af01 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3445,20 +3445,8 @@ inline void gcode_G28() { // Re-orient the current position without leveling // based on where the steppers are positioned. // - #if IS_KINEMATIC - - // For DELTA/SCARA we need to apply forward kinematics. - // This returns raw positions and we remap to the space. - get_cartesian_from_steppers(); - LOOP_XYZ(i) current_position[i] = LOGICAL_POSITION(cartes[i], i); - - #else - - // For cartesian/core the steppers are already mapped to - // the coordinate space by design. - LOOP_XYZ(i) current_position[i] = stepper.get_axis_position_mm((AxisEnum)i); - - #endif // !DELTA + get_cartesian_from_steppers(); + memcpy(current_position, cartes, sizeof(cartes)); // Inform the planner about the new coordinates SYNC_PLAN_POSITION_KINEMATIC(); @@ -7918,11 +7906,16 @@ void get_cartesian_from_steppers() { stepper.get_axis_position_mm(B_AXIS), stepper.get_axis_position_mm(C_AXIS) ); + cartes[X_AXIS] += LOGICAL_X_POSITION(0); + cartes[Y_AXIS] += LOGICAL_Y_POSITION(0); + cartes[Z_AXIS] += LOGICAL_Z_POSITION(0); #elif IS_SCARA forward_kinematics_SCARA( stepper.get_axis_position_degrees(A_AXIS), stepper.get_axis_position_degrees(B_AXIS) ); + cartes[X_AXIS] += LOGICAL_X_POSITION(0); + cartes[Y_AXIS] += LOGICAL_Y_POSITION(0); cartes[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS); #else cartes[X_AXIS] = stepper.get_axis_position_mm(X_AXIS);