From 02e5225e10bd74404aaad8d374b905d9db76b2f9 Mon Sep 17 00:00:00 2001 From: Darsey Litzenberger Date: Fri, 18 Jul 2025 23:48:08 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Allow=20Nozzle=20Wipe=20odd=20li?= =?UTF-8?q?near=20count=20(#27952)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/libs/nozzle.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index ad77e1e0ae..11d3277ca9 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -51,25 +51,23 @@ Nozzle nozzle; const xyz_pos_t oldpos = current_position; #endif - // Move to the starting point - #if ENABLED(NOZZLE_CLEAN_NO_Z) - #if ENABLED(NOZZLE_CLEAN_NO_Y) - do_blocking_move_to_x(start.x); - #else - do_blocking_move_to_xy(start); - #endif - #else + // Move Z (and XY) to the starting point, if needed + #if DISABLED(NOZZLE_CLEAN_NO_Z) do_blocking_move_to(start); #endif - // Start the stroke pattern - for (uint8_t i = 0; i < strokes >> 1; ++i) { + // Run the stroke pattern + for (uint8_t i = 0; i <= strokes; ++i) { #if ENABLED(NOZZLE_CLEAN_NO_Y) - do_blocking_move_to_x(end.x); - do_blocking_move_to_x(start.x); + if (i & 1) + do_blocking_move_to_x(end.x); + else + do_blocking_move_to_x(start.x); #else - do_blocking_move_to_xy(end); - do_blocking_move_to_xy(start); + if (i & 1) + do_blocking_move_to_x(end); + else + do_blocking_move_to_x(start); #endif }