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

Fixed Backlash::get_applied_steps() #27208

Conversation

tombrazier
Copy link
Contributor

@tombrazier tombrazier commented Jun 25, 2024

Description

#25791 broke an assumption in Backlash::get_applied_steps() by changing the meaning of the initial state of last_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 of last_direction_bits has the opposite meaning. So the first time backlash is applied now is for a forward movement. But Backlash::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

…tion in Backlash::get_applied_steps() that the zero backlash steps applied state is forwards
@thinkyhead thinkyhead merged commit a4d2003 into MarlinFirmware:bugfix-2.1.x Jul 5, 2024
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants