Fixed Backlash::get_applied_steps() #27208
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
#25791 broke an assumption in
Backlash::get_applied_steps()
by changing the meaning of the initial state oflast_direction_bits
. This variable is initialised to zero, which used to mean that at startup the "previous" movements were assumed to be forwards. Consequently for the first time backlash was applied was on a backwards (i.e. -ve direction) movement. With the new semantics the initial state oflast_direction_bits
has the opposite meaning. So the first time backlash is applied now is for a forward movement. ButBacklash::get_applied_steps()
was not updated to reflect this change.This PR returns the behaviour of
Backlash::get_applied_steps()
to what it was before #25791, i.e. it returns the actual number of steps that have been added for backlash compensation.Requirements
Enable backlash correction.
Benefits
Incorrect information returned from
Backlash::get_applied_steps()
may cause bugs which are strange, subtle and difficult to trace. For example,M114 D
will give different values for the "Stepper:" positions on a freshly booted machine depending on whether it loaded config from EEPROM or reset from hard coded defaults. i.e. flash a new firmware and you get one value but reboot and you get a different value.Configurations
Enable
BACKLASH_COMPENSATION
.Related Issues