From d4a1154c25093c35d4bc940c5f0017e4ff48d2c7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 10 Nov 2017 20:49:37 -0600 Subject: [PATCH] Use do_blocking_move_to where possible --- Marlin/src/feature/bedlevel/bedlevel.cpp | 11 +++----- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 28 ++++++++------------- Marlin/src/module/motion.cpp | 3 +++ 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 2e1037f14..d1759efa9 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -260,13 +260,10 @@ void reset_bed_level() { #if MANUAL_PROBE_HEIGHT > 0 const float prev_z = current_position[Z_AXIS]; - do_blocking_move_to_z(MANUAL_PROBE_HEIGHT, homing_feedrate(Z_AXIS)); - #endif - - do_blocking_move_to_xy(rx, ry, MMM_TO_MMS(XY_PROBE_SPEED)); - - #if MANUAL_PROBE_HEIGHT > 0 - do_blocking_move_to_z(prev_z, homing_feedrate(Z_AXIS)); + do_blocking_move_to(rx, ry, MANUAL_PROBE_HEIGHT); + do_blocking_move_to_z(prev_z); + #else + do_blocking_move_to_xy(rx, ry); #endif current_position[X_AXIS] = rx; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 57bcabf35..94bc875f0 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -467,6 +467,7 @@ // SERIAL_PROTOCOLLNPGM("Manually probing unreachable mesh locations."); do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); + if (!g29_x_flag && !g29_y_flag) { /** * Use a good default location for the path. @@ -910,12 +911,11 @@ static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); } - float unified_bed_leveling::measure_business_card_thickness(float in_height) { + float unified_bed_leveling::measure_business_card_thickness(const float in_height) { has_control_of_lcd_panel = true; save_ubl_active_state_and_disable(); // Disable bed level correction for probing - do_blocking_move_to_z(in_height); - do_blocking_move_to_xy(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y))); + do_blocking_move_to(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y)), in_height); //, min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]) / 2.0); stepper.synchronize(); @@ -944,8 +944,6 @@ SERIAL_PROTOCOLLNPGM("mm thick."); } - in_height = current_position[Z_AXIS]; // do manual probing at lower height - has_control_of_lcd_panel = false; restore_ubl_active_state_and_leave(); @@ -958,8 +956,8 @@ has_control_of_lcd_panel = true; save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe - do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); - do_blocking_move_to_xy(rx, ry); + + do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); lcd_return_to_status(); @@ -974,11 +972,9 @@ if (!position_is_reachable(xProbe, yProbe)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points) - do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); - LCD_MESSAGEPGM(MSG_UBL_MOVING_TO_NEXT); - do_blocking_move_to_xy(xProbe, yProbe); + do_blocking_move_to(xProbe, yProbe, Z_CLEARANCE_BETWEEN_PROBES); do_blocking_move_to_z(z_clearance); KEEPALIVE_STATE(PAUSED_FOR_USER); @@ -1035,8 +1031,7 @@ restore_ubl_active_state_and_leave(); KEEPALIVE_STATE(IN_HANDLER); - do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); - do_blocking_move_to_xy(rx, ry); + do_blocking_move_to(rx, ry, Z_CLEARANCE_DEPLOY_PROBE); } #endif // NEWPANEL @@ -1486,8 +1481,7 @@ LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH); - do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); - do_blocking_move_to_xy(rx, ry); + do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); uint16_t not_done[16]; memset(not_done, 0xFF, sizeof(not_done)); @@ -1510,8 +1504,7 @@ if (isnan(new_z)) // if the mesh point is invalid, set it to 0.0 so it can be edited new_z = 0.0; - do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); // Move the nozzle to where we are going to edit - do_blocking_move_to_xy(rawx, rawy); + do_blocking_move_to(rawx, rawy, Z_CLEARANCE_BETWEEN_PROBES); // Move the nozzle to the edit point new_z = FLOOR(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place @@ -1571,9 +1564,8 @@ if (do_ubl_mesh_map) display_map(g29_map_type); restore_ubl_active_state_and_leave(); - do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); - do_blocking_move_to_xy(rx, ry); + do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH); SERIAL_ECHOLNPGM("Done Editing Mesh"); diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 854a8e34e..802190297 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -785,6 +785,9 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS }, * * This may result in several calls to planner.buffer_line to * do smaller moves for DELTA, SCARA, mesh moves, etc. + * + * Make sure current_position[E] and destination[E] are good + * before calling or cold/lengthy extrusion may get missed. */ void prepare_move_to_destination() { clamp_to_software_endstops(destination);