Skip to content

Commit

Permalink
Fix an error introduced by MarlinFirmware#25791 which broke an assump…
Browse files Browse the repository at this point in the history
…tion in Backlash::get_applied_steps() that the zero backlash steps applied state is forwards
  • Loading branch information
tombrazier committed Jun 25, 2024
1 parent 1e0719d commit 617b5dd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Marlin/src/feature/backlash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,14 @@ int32_t Backlash::get_applied_steps(const AxisEnum axis) {

const int32_t residual_error_axis = residual_error[axis];

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

if (forward) return -residual_error_axis;
if (!forward) return -residual_error_axis;

const float f_corr = float(correction) / all_on;
const int32_t full_error_axis = -f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
const int32_t full_error_axis = f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
return full_error_axis - residual_error_axis;
}

Expand Down

0 comments on commit 617b5dd

Please sign in to comment.