Use sync_plan_position_delta where needed

This commit is contained in:
Scott Lahteine 2016-06-21 16:17:48 -07:00
parent a6b8c67df4
commit bfccf26294

View File

@ -2035,7 +2035,12 @@ static void setup_for_endstop_move() {
// Get the current stepper position after bumping an endstop // Get the current stepper position after bumping an endstop
current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS); current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
#if ENABLED(SCARA)
sync_plan_position_delta();
#else
sync_plan_position(); sync_plan_position();
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position);
@ -2079,7 +2084,11 @@ static void setup_for_endstop_move() {
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position); if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
#endif #endif
#if ENABLED(SCARA)
sync_plan_position_delta();
#else
sync_plan_position(); sync_plan_position();
#endif
} }
#endif // !DELTA #endif // !DELTA
@ -2119,7 +2128,11 @@ static void setup_for_endstop_move() {
if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position); if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
#endif #endif
#if ENABLED(DELTA) || ENABLED(SCARA)
sync_plan_position_delta();
#else
sync_plan_position(); sync_plan_position();
#endif
} }
#endif // !AUTO_BED_LEVELING_GRID #endif // !AUTO_BED_LEVELING_GRID
@ -2321,7 +2334,11 @@ static void homeaxis(AxisEnum axis) {
// Set the axis position as setup for the move // Set the axis position as setup for the move
current_position[axis] = 0; current_position[axis] = 0;
#if ENABLED(DELTA) || ENABLED(SCARA)
sync_plan_position_delta();
#else
sync_plan_position(); sync_plan_position();
#endif
// Homing Z towards the bed? Deploy the Z probe or endstop. // Homing Z towards the bed? Deploy the Z probe or endstop.
#if HAS_BED_PROBE #if HAS_BED_PROBE
@ -2346,7 +2363,11 @@ static void homeaxis(AxisEnum axis) {
// Set the axis position as setup for the move // Set the axis position as setup for the move
current_position[axis] = 0; current_position[axis] = 0;
#if ENABLED(DELTA) || ENABLED(SCARA)
sync_plan_position_delta();
#else
sync_plan_position(); sync_plan_position();
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)"); if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
@ -2407,7 +2428,7 @@ static void homeaxis(AxisEnum axis) {
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)"); if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
#endif #endif
endstops.enable(false); // Disable endstops while moving away endstops.enable(false); // Disable endstops while moving away
sync_plan_position(); sync_plan_position_delta();
destination[axis] = endstop_adj[axis]; destination[axis] = endstop_adj[axis];
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
@ -2434,7 +2455,12 @@ static void homeaxis(AxisEnum axis) {
// Set the axis position to its home position (plus home offsets) // Set the axis position to its home position (plus home offsets)
set_axis_is_at_home(axis); set_axis_is_at_home(axis);
#if ENABLED(DELTA) || ENABLED(SCARA)
sync_plan_position_delta();
#else
sync_plan_position(); sync_plan_position();
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position);
@ -2485,7 +2511,7 @@ static void homeaxis(AxisEnum axis) {
if (retract_zlift > 0.01) { if (retract_zlift > 0.01) {
current_position[Z_AXIS] -= retract_zlift; current_position[Z_AXIS] -= retract_zlift;
#if ENABLED(DELTA) #if ENABLED(DELTA) || ENABLED(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else #else
sync_plan_position(); sync_plan_position();
@ -2497,7 +2523,7 @@ static void homeaxis(AxisEnum axis) {
if (retract_zlift > 0.01) { if (retract_zlift > 0.01) {
current_position[Z_AXIS] += retract_zlift; current_position[Z_AXIS] += retract_zlift;
#if ENABLED(DELTA) #if ENABLED(DELTA) || ENABLED(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else #else
sync_plan_position(); sync_plan_position();
@ -3056,14 +3082,14 @@ inline void gcode_G28() {
#endif // Z_HOME_DIR < 0 #endif // Z_HOME_DIR < 0
sync_plan_position();
#endif // else DELTA
#if ENABLED(SCARA) #if ENABLED(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else
sync_plan_position();
#endif #endif
#endif // !DELTA (gcode_G28)
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING) #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
endstops.enable(false); endstops.enable(false);
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
@ -3470,7 +3496,11 @@ inline void gcode_G28() {
if (DEBUGGING(LEVELING)) DEBUG_POS("AFTER matrix.set_to_identity", uncorrected_position); if (DEBUGGING(LEVELING)) DEBUG_POS("AFTER matrix.set_to_identity", uncorrected_position);
#endif #endif
#if ENABLED(SCARA)
sync_plan_position_delta();
#else
sync_plan_position(); sync_plan_position();
#endif
#endif // !DELTA #endif // !DELTA
} }
@ -3788,7 +3818,11 @@ inline void gcode_G28() {
#endif #endif
; ;
// current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home" // current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home"
#if ENABLED(SCARA)
sync_plan_position_delta();
#else
sync_plan_position(); sync_plan_position();
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
@ -6707,7 +6741,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
#endif // !DUAL_X_CARRIAGE #endif // !DUAL_X_CARRIAGE
// Tell the planner the new "current position" // Tell the planner the new "current position"
#if ENABLED(DELTA) #if ENABLED(DELTA) || ENABLED(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else #else
sync_plan_position(); sync_plan_position();