Marlin
Marlin copied to clipboard
Fixed Backlash::get_applied_steps()
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
.