Browse Source

Fix G34 move in wrong direction (#18188)

vanilla_fb_2.0.x
MoellerDi 5 years ago
committed by GitHub
parent
commit
fcb8c5a1c1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      Marlin/src/gcode/calibrate/G34_M422.cpp

11
Marlin/src/gcode/calibrate/G34_M422.cpp

@ -294,11 +294,14 @@ void GcodeSuite::G34() {
// Check for less accuracy compared to last move
if (last_z_align_move[zstepper] < z_align_abs * 0.7f) {
SERIAL_ECHOLNPGM("Decreasing accuracy detected.");
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " last_z_align_move = ", last_z_align_move[zstepper]);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " z_align_abs = ", z_align_abs);
adjustment_reverse = !adjustment_reverse;
}
// Remember the alignment for the next iteration
last_z_align_move[zstepper] = z_align_abs;
// Remember the alignment for the next iteration, but only if steppers move,
// otherwise it would be just zero (in case this stepper was at z_measured_min already)
if (z_align_abs > 0) last_z_align_move[zstepper] = z_align_abs;
#endif
// Stop early if all measured points achieve accuracy target
@ -312,8 +315,10 @@ void GcodeSuite::G34() {
#if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
// Decreasing accuracy was detected so move was inverted.
// Will match reversed Z steppers on dual steppers. Triple will need more work to map.
if (adjustment_reverse)
if (adjustment_reverse) {
z_align_move = -z_align_move;
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " correction reversed to ", z_align_move);
}
#endif
// Do a move to correct part of the misalignment for the current stepper

Loading…
Cancel
Save