Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coils alignment #18528

Merged
merged 11 commits into from
Jul 6, 2020
8 changes: 4 additions & 4 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1468,23 +1468,23 @@ void set_axis_not_trusted(const AxisEnum axis) {
phasePerUStep = 256 / (X_MICROSTEPS);
phaseCurrent = stepperX.get_microstep_counter();
effectorBackoutDir = -X_HOME_DIR;
stepperBackoutDir = INVERT_X_DIR ? -effectorBackoutDir : effectorBackoutDir;
stepperBackoutDir = INVERT_X_DIR ? effectorBackoutDir : -effectorBackoutDir;
break;
#endif
#ifdef Y_MICROSTEPS
case Y_AXIS:
phasePerUStep = 256 / (Y_MICROSTEPS);
phaseCurrent = stepperY.get_microstep_counter();
effectorBackoutDir = -Y_HOME_DIR;
stepperBackoutDir = INVERT_Y_DIR ? -effectorBackoutDir : effectorBackoutDir;
stepperBackoutDir = INVERT_Y_DIR ? effectorBackoutDir : -effectorBackoutDir;
break;
#endif
#ifdef Z_MICROSTEPS
case Z_AXIS:
phasePerUStep = 256 / (Z_MICROSTEPS);
phaseCurrent = stepperZ.get_microstep_counter();
effectorBackoutDir = -Z_HOME_DIR;
stepperBackoutDir = INVERT_Y_DIR ? -effectorBackoutDir : effectorBackoutDir;
stepperBackoutDir = INVERT_Z_DIR ? effectorBackoutDir : -effectorBackoutDir;
GMagician marked this conversation as resolved.
Show resolved Hide resolved
break;
#endif
default: return;
Expand All @@ -1502,7 +1502,7 @@ void set_axis_not_trusted(const AxisEnum axis) {
// Skip to next if target position is behind current. So it only moves away from endstop.
if (phaseDelta < 0) phaseDelta += 1024;

// Convert tmc µsteps(phase) to whole Marlin µsteps to effector to backout direction to mm
// Convert tmc µsteps(phase) to whole Marlin µsteps to effector backout direction to mm
const float mmDelta = int16_t(phaseDelta / phasePerUStep) * effectorBackoutDir * planner.steps_to_mm[axis];
GMagician marked this conversation as resolved.
Show resolved Hide resolved

// optional debug messages.
Expand Down