1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 07:17:59 +00:00

🐛 Fix backlash intial direction (#27208)

Fix regression from #25791
This commit is contained in:
tombrazier 2024-07-05 02:33:45 +01:00 committed by GitHub
parent 3c60145792
commit a4d20031ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -171,13 +171,14 @@ int32_t Backlash::get_applied_steps(const AxisEnum axis) {
const int32_t residual_error_axis = residual_error[axis]; const int32_t residual_error_axis = residual_error[axis];
// At startup it is assumed the last move was forward. // At startup, when no steps are applied, it is assumed the last move was backwards.
// So the applied steps will always be negative. // 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 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; return full_error_axis - residual_error_axis;
} }