From 5398bfab3648c249c8af58e23b42220b9e753795 Mon Sep 17 00:00:00 2001 From: ScrewThisBanana <71625822+ScrewThisBanana@users.noreply.github.com> Date: Sat, 23 Jan 2021 04:02:22 +0100 Subject: [PATCH] Adding custom move feedrate for G26 (#20729) * Adding custom move feedrate for G26 This commit adds an additional configuration parameter that can be used to specify the movement speed during the G26 validation pattern command during moves without extrusion. Closes MarlinFirmware/Marlin#20615 * Fixing missing default 'G26_XY_FEEDRATE_MOVE' value This commit adds a default 'G26_XY_FEEDRATE_MOVE' value (max movement speed / 1.5) in the G26.cpp - same behaviour as the default 'G26_XY_FEEDRATE' value * Adding comment describing functionality in G26.cpp * Renaming 'G26_XY_FEEDRATE_MOVE' to 'G26_XY_FEEDRATE_TRAVEL' Configuration parameter renamed for better readability and consistency MarlinFirmware/Marlin#20615 * Setting 'G26_XY_FEEDRATE_TRAVEL' to a safer value, aligned comments Changed default value for 'G26_XY_FEEDRATE_TRAVEL' from 150 mm/s to 100 mm/s for safety purposes, comment alignment MarlinFirmware/Marlin#20615 --- Marlin/Configuration.h | 1 + Marlin/src/gcode/bedlevel/G26.cpp | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d86c448441..0b5883d88b 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1361,6 +1361,7 @@ #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE_TRAVEL 100 // (mm/s) Feedrate for XY Moves without extrusion for the G26 Mesh Validation Tool #define G26_RETRACT_MULTIPLIER 1.0 // G26 Q (retraction) used by default between mesh test elements. #endif diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 650b039b55..c583b505cb 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -128,6 +128,10 @@ #define G26_XY_FEEDRATE (PLANNER_XY_FEEDRATE() / 3.0) #endif +#ifndef G26_XY_FEEDRATE_TRAVEL + #define G26_XY_FEEDRATE_TRAVEL (PLANNER_XY_FEEDRATE() / 1.5) +#endif + #if CROSSHAIRS_SIZE >= INTERSECTION_CIRCLE_RADIUS #error "CROSSHAIRS_SIZE must be less than INTERSECTION_CIRCLE_RADIUS." #endif @@ -213,7 +217,8 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de const xy_pos_t dest = { rx, ry }; - const bool has_xy_component = dest != current_position; // Check if X or Y is involved in the movement. + const bool has_xy_component = dest != current_position; // Check if X or Y is involved in the movement. + const bool has_e_component = e_delta != 0.0; destination = current_position; @@ -224,10 +229,15 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de destination = current_position; } - // If X or Y is involved do a 'normal' move. Otherwise retract/recover/hop. + // If X or Y in combination with E is involved do a 'normal' move. + // If X or Y with no E is involved do a 'fast' move + // Otherwise retract/recover/hop. destination = dest; destination.e += e_delta; - const feedRate_t feed_value = has_xy_component ? feedRate_t(G26_XY_FEEDRATE) : planner.settings.max_feedrate_mm_s[E_AXIS] * 0.666f; + const feedRate_t feed_value = + has_xy_component + ? (has_e_component ? feedRate_t(G26_XY_FEEDRATE) : feedRate_t(G26_XY_FEEDRATE_TRAVEL)) + : planner.settings.max_feedrate_mm_s[E_AXIS] * 0.666f; prepare_internal_move_to_destination(feed_value); destination = current_position; }