Browse Source

Fix G34 move in wrong direction (#18188)

MoellerDi 4 years ago
parent
commit
fcb8c5a1c1
No account linked to committer's email address
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      Marlin/src/gcode/calibrate/G34_M422.cpp

+ 8
- 3
Marlin/src/gcode/calibrate/G34_M422.cpp View File

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

Loading…
Cancel
Save