Skip to content

Commit a4d2003

Browse files
authored
🐛 Fix backlash intial direction (#27208)
Fix regression from #25791
1 parent 3c60145 commit a4d2003

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Marlin/src/feature/backlash.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,14 @@ int32_t Backlash::get_applied_steps(const AxisEnum axis) {
171171

172172
const int32_t residual_error_axis = residual_error[axis];
173173

174-
// At startup it is assumed the last move was forward.
175-
// So the applied steps will always be negative.
174+
// At startup, when no steps are applied, it is assumed the last move was backwards.
175+
// So the applied steps will always be zero (when moving backwards) or a positive
176+
// number (when moving forwards).
176177

177-
if (forward) return -residual_error_axis;
178+
if (!forward) return -residual_error_axis;
178179

179180
const float f_corr = float(correction) / all_on;
180-
const int32_t full_error_axis = -f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
181+
const int32_t full_error_axis = f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
181182
return full_error_axis - residual_error_axis;
182183
}
183184

0 commit comments

Comments
 (0)