-
Notifications
You must be signed in to change notification settings - Fork 1
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
Unify run_z_probe #57
Conversation
@thinkyhead Tested as working for my Prusa i3. For the reasons why see: |
ed8e42b
to
71541c8
Compare
if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position); | ||
#endif | ||
#if ENABLED(AUTO_BED_LEVELING_FEATURE) | ||
planner.bed_level_matrix.set_to_identity(); |
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.
Yes, odd this wasn't already being done for delta. Should this also contain "#if (DELTA) reset_bed_level()
"?
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.
No. This should be done in the callers (G29, G30, M48). Will check.
A unified 'switch_of_leveling()' would be nice. Only one place to decide what kind of leveling to switch of - and compensate.
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.
Aiii. That opens a can of worms
run_z_probe() {
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
planner.bed_level_matrix.set_to_identity();
#endif
-----------------------------
gcode_G28() {
// For auto bed leveling, clear the level matrix
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
planner.bed_level_matrix.set_to_identity();
#if ENABLED(DELTA)
reset_bed_level();
#endif
#endif
/**
* For mesh bed leveling deactivate the mesh calculations, will be turned
* on again when homing all axis
*/
#if ENABLED(MESH_BED_LEVELING)
float pre_home_z = MESH_HOME_SEARCH_Z;
if (mbl.active()) {
// Save known Z position if already homed
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
pre_home_z = current_position[Z_AXIS];
pre_home_z += mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS));
}
mbl.set_active(false);
current_position[Z_AXIS] = pre_home_z;
}
#endif
--------------------------------------
G29 (mesh)
case MeshReset:
if (mbl.active()) {
current_position[Z_AXIS] +=
mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS)) - MESH_HOME_SEARCH_Z;
mbl.reset();
SYNC_PLAN_POSITION_KINEMATIC();
}
else
mbl.reset();
-------------------------------------
G29 (grid)
// make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
planner.bed_level_matrix.set_to_identity();
#if ENABLED(DELTA)
reset_bed_level();
#else //!DELTA
-------------------------------------------
gcode_G30() {
// TODO: clear the leveling matrix or the planner will be set incorrectly
--------------------------------------------
M48
#if ENABLED(DELTA)
// we don't do bed level correction in M48 because we want the raw data when we probe
reset_bed_level();
#elif ENABLED(AUTO_BED_LEVELING_FEATURE)
// we don't do bed level correction in M48 because we want the raw data when we probe
planner.bed_level_matrix.set_to_identity();
#endif
---------------------------
- Not two of these do the same.
- If the matrix is involved it theoretically needs a correction in x, y and z when the matrix is set to identity.
- In DELTA leveling it needs a correction in z when switching off.
- Dito for MESH.
*
Enough stuff to think about.
This is great. Amazing how much the leveling code is condensing. ❓ But will it fix our friend's probing-in-only-one-quadrant problem❓ That would be a bonus. |
3bdb223
to
191ce59
Compare
That's hopefully fixed by MarlinFirmware#4303. |
8d0255c
to
2d8eeb2
Compare
Unify run_z_probe Add double touch for DELTAs. Introduce Z_PROBE_SPEED_FAST and Z_PROBE_SPEED_SLOW defaulting to homing_feedrate_mm_m[Z_AXIS] and homing_feedrate_mm_m[Z_AXIS]/2
Unify run_z_probe
Add double touch for DELTAs.