From d3a05de96eafd7b113183947441936f8b3f85107 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 18 Jun 2016 01:16:26 -0700 Subject: [PATCH 1/3] Save and restore feedrate in probe functions --- Marlin/Marlin_main.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 2246368997..71d383a615 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1667,6 +1667,8 @@ static void setup_for_endstop_move() { static void run_z_probe() { + float old_feedrate = feedrate; + /** * To prevent stepper_inactive_time from running out and * EXTRUDER_RUNOUT_PREVENT from extruding @@ -1743,6 +1745,8 @@ static void setup_for_endstop_move() { #endif #endif // !DELTA + + feedrate = old_feedrate; } /** @@ -1750,7 +1754,7 @@ static void setup_for_endstop_move() { * The final current_position may not be the one that was requested */ static void do_blocking_move_to(float x, float y, float z) { - float oldFeedRate = feedrate; + float old_feedrate = feedrate; #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) print_xyz("do_blocking_move_to", x, y, z); @@ -1769,8 +1773,6 @@ static void setup_for_endstop_move() { else prepare_move_to_destination(); // this will also set_current_to_destination - stepper.synchronize(); - #else feedrate = homing_feedrate[Z_AXIS]; @@ -1784,11 +1786,12 @@ static void setup_for_endstop_move() { current_position[X_AXIS] = x; current_position[Y_AXIS] = y; line_to_current_position(); - stepper.synchronize(); #endif - feedrate = oldFeedRate; + stepper.synchronize(); + + feedrate = old_feedrate; } inline void do_blocking_move_to_xy(float x, float y) { @@ -1838,6 +1841,8 @@ static void setup_for_endstop_move() { DEPLOY_Z_SERVO(); #elif ENABLED(Z_PROBE_ALLEN_KEY) + float old_feedrate = feedrate; + feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE; // If endstop is already false, the Z probe is deployed @@ -1890,6 +1895,8 @@ static void setup_for_endstop_move() { destination[Y_AXIS] = destination[Y_AXIS] * 0.75; prepare_move_to_destination_raw(); // this will also set_current_to_destination + feedrate = old_feedrate; + stepper.synchronize(); #if ENABLED(Z_MIN_PROBE_ENDSTOP) @@ -1943,6 +1950,8 @@ static void setup_for_endstop_move() { #elif ENABLED(Z_PROBE_ALLEN_KEY) + float old_feedrate = feedrate; + // Move up for safety feedrate = Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE; @@ -1983,6 +1992,8 @@ static void setup_for_endstop_move() { destination[Y_AXIS] = 0; prepare_move_to_destination_raw(); // this will also set_current_to_destination + feedrate = old_feedrate; + stepper.synchronize(); #if ENABLED(Z_MIN_PROBE_ENDSTOP) @@ -3829,9 +3840,8 @@ inline void gcode_G28() { // TODO: clear the leveling matrix or the planner will be set incorrectly setup_for_endstop_move(); // Too late. Must be done before deploying. - feedrate = homing_feedrate[Z_AXIS]; - run_z_probe(); + SERIAL_PROTOCOLPGM("Bed X: "); SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001); SERIAL_PROTOCOLPGM(" Y: "); From d36d4edd8017363cf6e67b024e2d8814b83bca99 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 18 Jun 2016 01:16:50 -0700 Subject: [PATCH 2/3] Tweak partial homing code --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 71d383a615..58113f2a21 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1891,8 +1891,8 @@ static void setup_for_endstop_move() { } // Partially Home X,Y for safety - destination[X_AXIS] = destination[X_AXIS] * 0.75; - destination[Y_AXIS] = destination[Y_AXIS] * 0.75; + destination[X_AXIS] *= 0.75; + destination[Y_AXIS] *= 0.75; prepare_move_to_destination_raw(); // this will also set_current_to_destination feedrate = old_feedrate; From 4e860babbc86fb19382fff0ff1685e2939a05b1c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 18 Jun 2016 01:40:49 -0700 Subject: [PATCH 3/3] Allow setting xy_travel_speed for delta leveling also --- Marlin/Marlin_main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 58113f2a21..28324d02e6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1762,7 +1762,7 @@ static void setup_for_endstop_move() { #if ENABLED(DELTA) - feedrate = XY_TRAVEL_SPEED; + feedrate = xy_travel_speed; destination[X_AXIS] = x; destination[Y_AXIS] = y; @@ -1854,7 +1854,6 @@ static void setup_for_endstop_move() { if (z_min_endstop) #endif { - // Move to the start position to initiate deployment destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_X; destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Y;