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
[1.1.x] Fix M428 #8397
[1.1.x] Fix M428 #8397
Conversation
Marlin/Marlin_main.cpp
Outdated
BUZZ(100, 698); | ||
} | ||
LOOP_XYZ(i) | ||
set_home_offset((AxisEnum)i, -1.0f * current_position[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with this is that it doesn't account for min versus max endstops. The "home position" for a max endstop might be something like 300. Simply setting the home offset based on the current position assumes that the home position set in the configuration is always going to be zero. The logic needs to account for the difference between the current position and the endstop — so the current implementation simply works from the distance between the current position and the nearest end of the axis.
Marlin/Marlin_main.cpp
Outdated
bool err = false; | ||
LOOP_XYZ(i) { | ||
if (axis_homed[i]) { | ||
const float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recent issues with M428
are probably primarily related to the broken report_current_position
function, but might also be related to the fact that we changed soft endstops to use the borders of the printable (bed) region and no longer the hard endstops (MIN|MAX)_[XYZ]_POS
. To revert to the previous (non-broken) behavior, the base_min_pos()
and base_max_pos()
might be better than soft_endstop_(min|max)
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The website describes M428
this way:
The current position is set to the native home position.
It doesn't describe the case where "home position" is something like X200 Y0 Z0
so that needs to be added. But the idea is, shortly after you home, you would move the axes a little until you have your preferred position within the bed, but relatively close to the endstop. The M428
command makes the current point correspond to the configured endstop position by setting home_offset
appropriately.
3f2f181
to
ea35b40
Compare
Reviewing the intent of
If that last item sounds like the existing implementation, you're starting to see why it was done that way. However, I have clarified the code so it should make more sense to the casual reader, and maybe even improved it a little. Description:
|
80acc92
to
fac5484
Compare
fac5484
to
227b96b
Compare
444fcf9
to
25ec0fe
Compare
Addressing #8362
This fixes the old implementation of M428 which was broken and did not
match the official documentation. The implementation is basically the same as the M206 implementation.
I also fixed a typo in M114 which applied the wrong offsets to the Y position.
I can prepare a version for 2.0.x if people think this doesn't need any changes.