From 41b5c48129affe05f438d1814acf2d5371fdc09e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:00:46 -0500 Subject: [PATCH 01/13] Update software endstops if EEPROM is loaded --- Marlin/Marlin.h | 1 + Marlin/Marlin_main.cpp | 2 +- Marlin/configuration_store.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 28c3250a30..2faeb9f867 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -379,6 +379,7 @@ extern uint8_t active_extruder; extern float mixing_factor[MIXING_STEPPERS]; #endif +void update_software_endstops(AxisEnum axis); void calculate_volumetric_multipliers(); // Buzzer diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 0a385622bc..af4312071d 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1470,7 +1470,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); * the software endstop positions must be refreshed to remain * at the same positions relative to the machine. */ -static void update_software_endstops(AxisEnum axis) { +void update_software_endstops(AxisEnum axis) { float offs = LOGICAL_POSITION(0, axis); #if ENABLED(DUAL_X_CARRIAGE) diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index db10bba150..f54cd88a2f 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -186,6 +186,9 @@ void Config_Postprocess() { #endif calculate_volumetric_multipliers(); + + // Software endstops depend on home_offset + LOOP_XYZ(i) update_software_endstops((AxisEnum)i); } #if ENABLED(EEPROM_SETTINGS) From a1bad589c956374821bf1fffe08ceade46889b3a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:09:03 -0500 Subject: [PATCH 02/13] Augment debug/homing logging --- Marlin/Marlin_main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index af4312071d..c2ea6653fd 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1530,7 +1530,7 @@ static void set_home_offset(AxisEnum axis, float v) { static void set_axis_is_at_home(AxisEnum axis) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis); + SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis_codes[axis]); SERIAL_ECHOLNPGM(")"); } #endif @@ -1606,7 +1606,7 @@ static void set_axis_is_at_home(AxisEnum axis) { } #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis); + SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]); SERIAL_ECHOLNPGM(")"); } #endif @@ -2131,6 +2131,10 @@ static void clean_up_after_endstop_or_probe_move() { // at the height where the probe triggered. static float run_z_probe() { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position); + #endif + // Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding refresh_cmd_timeout(); @@ -2158,7 +2162,7 @@ static void clean_up_after_endstop_or_probe_move() { SYNC_PLAN_POSITION_KINEMATIC(); #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position); + if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position); #endif return current_position[Z_AXIS]; @@ -2403,7 +2407,7 @@ static void homeaxis(AxisEnum axis) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(">>> homeaxis(", axis); + SERIAL_ECHOPAIR(">>> homeaxis(", axis_codes[axis]); SERIAL_ECHOLNPGM(")"); } #endif @@ -2514,7 +2518,7 @@ static void homeaxis(AxisEnum axis) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("<<< homeaxis(", axis); + SERIAL_ECHOPAIR("<<< homeaxis(", axis_codes[axis]); SERIAL_ECHOLNPGM(")"); } #endif From 7a4ccd7967e2fe0fb875b940d328d68df6f1f251 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:10:41 -0500 Subject: [PATCH 03/13] Add do_probe_move with Z fixes --- Marlin/Marlin_main.cpp | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index c2ea6653fd..5cbf48c3a9 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2127,6 +2127,28 @@ static void clean_up_after_endstop_or_probe_move() { return false; } + static void do_probe_move(float z, float fr_mm_m) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position); + #endif + + // Move down until probe triggered + do_blocking_move_to_z(LOGICAL_Z_POSITION(z), MMM_TO_MMS(fr_mm_m)); + + // Clear endstop flags + endstops.hit_on_purpose(); + + // Get Z where the steppers were interrupted + set_current_from_steppers_for_axis(Z_AXIS); + + // Tell the planner where we actually are + SYNC_PLAN_POSITION_KINEMATIC(); + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position); + #endif + } + // Do a single Z probe and return with current_position[Z_AXIS] // at the height where the probe triggered. static float run_z_probe() { @@ -2143,12 +2165,11 @@ static void clean_up_after_endstop_or_probe_move() { #endif #if ENABLED(PROBE_DOUBLE_TOUCH) - do_blocking_move_to_z(-(Z_MAX_LENGTH + 10), MMM_TO_MMS(Z_PROBE_SPEED_FAST)); - endstops.hit_on_purpose(); - set_current_from_steppers_for_axis(Z_AXIS); - SYNC_PLAN_POSITION_KINEMATIC(); - // move up the retract distance + // Do a first probe at the fast speed + do_probe_move(-(Z_MAX_LENGTH) - 10, Z_PROBE_SPEED_FAST); + + // move up by the bump distance do_blocking_move_to_z(current_position[Z_AXIS] + home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_FAST)); #else // move fast, close to the bed @@ -2156,10 +2177,7 @@ static void clean_up_after_endstop_or_probe_move() { #endif // move down slowly to find bed - do_blocking_move_to_z(current_position[Z_AXIS] -2.0*home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_SLOW)); - endstops.hit_on_purpose(); - set_current_from_steppers_for_axis(Z_AXIS); - SYNC_PLAN_POSITION_KINEMATIC(); + do_probe_move(-10, Z_PROBE_SPEED_SLOW); #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position); From ead333e7dac5997d2f6f4b129964940018ff1161 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:11:41 -0500 Subject: [PATCH 04/13] line_to_axis_pos => do_homing_move --- Marlin/Marlin_main.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5cbf48c3a9..3505018b3b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1638,15 +1638,6 @@ inline void line_to_z(float zPosition) { planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate_mm_s, active_extruder); } -inline void line_to_axis_pos(AxisEnum axis, float where, float fr_mm_s = 0.0) { - float old_feedrate_mm_s = feedrate_mm_s; - current_position[axis] = where; - feedrate_mm_s = (fr_mm_s != 0.0) ? fr_mm_s : homing_feedrate_mm_s[axis]; - planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, active_extruder); - stepper.synchronize(); - feedrate_mm_s = old_feedrate_mm_s; -} - // // line_to_destination // Move the planner, not necessarily synced with current_position @@ -2415,6 +2406,15 @@ static void clean_up_after_endstop_or_probe_move() { * Home an individual axis */ +static void do_homing_move(AxisEnum axis, float where, float fr_mm_s = 0.0) { + float old_feedrate_mm_s = feedrate_mm_s; + current_position[axis] = where; + feedrate_mm_s = (fr_mm_s != 0.0) ? fr_mm_s : homing_feedrate_mm_s[axis]; + planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, active_extruder); + stepper.synchronize(); + feedrate_mm_s = old_feedrate_mm_s; +} + #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) static void homeaxis(AxisEnum axis) { @@ -2456,17 +2456,17 @@ static void homeaxis(AxisEnum axis) { #endif // Move towards the endstop until an endstop is triggered - line_to_axis_pos(axis, 1.5 * max_length(axis) * axis_home_dir); + do_homing_move(axis, 1.5 * max_length(axis) * axis_home_dir); // Set the axis position as setup for the move current_position[axis] = 0; sync_plan_position(); // Move away from the endstop by the axis HOME_BUMP_MM - line_to_axis_pos(axis, -home_bump_mm(axis) * axis_home_dir); + do_homing_move(axis, -home_bump_mm(axis) * axis_home_dir); // Move slowly towards the endstop until triggered - line_to_axis_pos(axis, 2 * home_bump_mm(axis) * axis_home_dir, get_homing_bump_feedrate(axis)); + do_homing_move(axis, 2 * home_bump_mm(axis) * axis_home_dir, get_homing_bump_feedrate(axis)); // reset current_position to 0 to reflect hitting endpoint current_position[axis] = 0; @@ -2490,7 +2490,7 @@ static void homeaxis(AxisEnum axis) { if (lockZ1) stepper.set_z_lock(true); else stepper.set_z2_lock(true); // Move to the adjusted endstop height - line_to_axis_pos(axis, adj); + do_homing_move(axis, adj); if (lockZ1) stepper.set_z_lock(false); else stepper.set_z2_lock(false); stepper.set_homing_flag(false); @@ -2506,7 +2506,7 @@ static void homeaxis(AxisEnum axis) { DEBUG_POS("", current_position); } #endif - line_to_axis_pos(axis, endstop_adj[axis]); + do_homing_move(axis, endstop_adj[axis]); } #endif From 748228cf402a29a91526fa3033581e4f31a648a2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:12:16 -0500 Subject: [PATCH 05/13] Use named indices for delta_grid_spacing --- Marlin/Marlin_main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 3505018b3b..2c0fff2f7b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3613,8 +3613,8 @@ inline void gcode_G28() { yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1); #if ENABLED(DELTA) - delta_grid_spacing[0] = xGridSpacing; - delta_grid_spacing[1] = yGridSpacing; + delta_grid_spacing[X_AXIS] = xGridSpacing; + delta_grid_spacing[Y_AXIS] = yGridSpacing; float zoffset = zprobe_zoffset; if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS); #else // !DELTA @@ -7897,12 +7897,12 @@ void clamp_to_software_endstops(float target[3]) { // Adjust print surface height by linear interpolation over the bed_level array. void adjust_delta(float cartesian[3]) { - if (delta_grid_spacing[0] == 0 || delta_grid_spacing[1] == 0) return; // G29 not done! + if (delta_grid_spacing[X_AXIS] == 0 || delta_grid_spacing[Y_AXIS] == 0) return; // G29 not done! int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2; float h1 = 0.001 - half, h2 = half - 0.001, - grid_x = max(h1, min(h2, RAW_X_POSITION(cartesian[X_AXIS]) / delta_grid_spacing[0])), - grid_y = max(h1, min(h2, RAW_Y_POSITION(cartesian[Y_AXIS]) / delta_grid_spacing[1])); + grid_x = max(h1, min(h2, RAW_X_POSITION(cartesian[X_AXIS]) / delta_grid_spacing[X_AXIS])), + grid_y = max(h1, min(h2, RAW_Y_POSITION(cartesian[Y_AXIS]) / delta_grid_spacing[Y_AXIS])); int floor_x = floor(grid_x), floor_y = floor(grid_y); float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y, z1 = bed_level[floor_x + half][floor_y + half], From 1f776f60342b29b7d72a6f5b4f62ac304331684a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:12:41 -0500 Subject: [PATCH 06/13] Tweak some code comments --- Marlin/Marlin_main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 2c0fff2f7b..faaa4c90a4 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2540,7 +2540,7 @@ static void homeaxis(AxisEnum axis) { SERIAL_ECHOLNPGM(")"); } #endif -} +} // homeaxis() #if ENABLED(FWRETRACT) @@ -3659,10 +3659,10 @@ inline void gcode_G28() { double xProbe = left_probe_bed_position + xGridSpacing * xCount; #if ENABLED(DELTA) - // Avoid probing the corners (outside the round or hexagon print surface) on a delta printer. + // Avoid probing outside the round or hexagonal area of a delta printer float distance_from_center = HYPOT(xProbe, yProbe); if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue; - #endif //DELTA + #endif float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); From 55355a4fb897537af511a75878c8b2005685ee82 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:14:36 -0500 Subject: [PATCH 07/13] Make probed points more symmetrical --- Marlin/Marlin_main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index faaa4c90a4..79d937d242 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3609,8 +3609,8 @@ inline void gcode_G28() { #if ENABLED(AUTO_BED_LEVELING_GRID) // probe at the points of a lattice grid - const int xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points - 1), - yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1); + const float xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points - 1), + yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1); #if ENABLED(DELTA) delta_grid_spacing[X_AXIS] = xGridSpacing; @@ -3639,7 +3639,8 @@ inline void gcode_G28() { bool zig = (auto_bed_leveling_grid_points & 1) ? true : false; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION] for (int yCount = 0; yCount < auto_bed_leveling_grid_points; yCount++) { - double yProbe = front_probe_bed_position + yGridSpacing * yCount; + float yBase = front_probe_bed_position + yGridSpacing * yCount, + yProbe = floor(yProbe + (yProbe < 0 ? 0 : 0.5)); int xStart, xStop, xInc; if (zig) { @@ -3656,7 +3657,8 @@ inline void gcode_G28() { zig = !zig; for (int xCount = xStart; xCount != xStop; xCount += xInc) { - double xProbe = left_probe_bed_position + xGridSpacing * xCount; + float xBase = left_probe_bed_position + xGridSpacing * xCount, + xProbe = floor(xProbe + (xProbe < 0 ? 0 : 0.5)); #if ENABLED(DELTA) // Avoid probing outside the round or hexagonal area of a delta printer From 9b1f3f7d120f04475a033a4a63cbc49f613b0b4c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 04:31:03 -0500 Subject: [PATCH 08/13] Sanity-check DELTA + AUTO_BED_LEVELING_GRID_POINTS --- Marlin/SanityCheck.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index fc866b121a..228486ee87 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -191,6 +191,13 @@ #if DISABLED(USE_XMAX_PLUG) && DISABLED(USE_YMAX_PLUG) && DISABLED(USE_ZMAX_PLUG) #error "You probably want to use Max Endstops for DELTA!" #endif + #if ENABLED(AUTO_BED_LEVELING_GRID) + #if (AUTO_BED_LEVELING_GRID_POINTS & 1) == 0 + #error "DELTA requires an odd value for AUTO_BED_LEVELING_GRID_POINTS." + #elif AUTO_BED_LEVELING_GRID_POINTS < 3 + #error "DELTA requires at least 3 AUTO_BED_LEVELING_GRID_POINTS." + #endif + #endif #endif /** From 99b22d5785deec25eb7b876dadec9c91c7767e72 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 04:31:19 -0500 Subject: [PATCH 09/13] Default AUTO_BED_LEVELING_GRID_POINTS to 3 --- Marlin/Configuration.h | 2 +- Marlin/example_configurations/Cartesio/Configuration.h | 2 +- Marlin/example_configurations/Felix/Configuration.h | 2 +- Marlin/example_configurations/Felix/DUAL/Configuration.h | 2 +- Marlin/example_configurations/Hephestos/Configuration.h | 2 +- Marlin/example_configurations/Hephestos_2/Configuration.h | 2 +- Marlin/example_configurations/K8200/Configuration.h | 2 +- Marlin/example_configurations/K8400/Configuration.h | 2 +- Marlin/example_configurations/K8400/Dual-head/Configuration.h | 2 +- .../RepRapWorld/Megatronics/Configuration.h | 2 +- Marlin/example_configurations/RigidBot/Configuration.h | 2 +- Marlin/example_configurations/SCARA/Configuration.h | 2 +- Marlin/example_configurations/TAZ4/Configuration.h | 2 +- Marlin/example_configurations/WITBOX/Configuration.h | 2 +- Marlin/example_configurations/adafruit/ST7565/Configuration.h | 2 +- Marlin/example_configurations/makibox/Configuration.h | 2 +- Marlin/example_configurations/tvrrug/Round2/Configuration.h | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9d384c5316..9d87aec637 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -689,7 +689,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/Cartesio/Configuration.h b/Marlin/example_configurations/Cartesio/Configuration.h index d96335b5fd..cf042af779 100644 --- a/Marlin/example_configurations/Cartesio/Configuration.h +++ b/Marlin/example_configurations/Cartesio/Configuration.h @@ -689,7 +689,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 21a9b9097f..5cc35ad365 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -671,7 +671,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/Felix/DUAL/Configuration.h b/Marlin/example_configurations/Felix/DUAL/Configuration.h index 86af23be76..bc1f77888f 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -669,7 +669,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 54d23670e6..74b9159492 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -681,7 +681,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index a0a4c288aa..440316a211 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -683,7 +683,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index d900176600..3268a52706 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -706,7 +706,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/K8400/Configuration.h b/Marlin/example_configurations/K8400/Configuration.h index 5add4d9dd1..70dbcc0639 100644 --- a/Marlin/example_configurations/K8400/Configuration.h +++ b/Marlin/example_configurations/K8400/Configuration.h @@ -689,7 +689,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/K8400/Dual-head/Configuration.h b/Marlin/example_configurations/K8400/Dual-head/Configuration.h index 817401f84f..8985296577 100644 --- a/Marlin/example_configurations/K8400/Dual-head/Configuration.h +++ b/Marlin/example_configurations/K8400/Dual-head/Configuration.h @@ -689,7 +689,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 2d9961c6df..684eba95d9 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -689,7 +689,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 6ba06b494a..1ff1626410 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -686,7 +686,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 7e55ee2db0..148c508690 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -697,7 +697,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index 6d4e159532..bd940ba4e3 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -710,7 +710,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 5df007ca7c..61c96d3e11 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -681,7 +681,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index be2b415ff5..2c5ca20d48 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -689,7 +689,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index cefe40d780..c6f7cf36f1 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -692,7 +692,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 5d8948da9b..714474aa5e 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -679,7 +679,7 @@ // Set the number of grid points per dimension. // You probably don't need more than 3 (squared=9). - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define AUTO_BED_LEVELING_GRID_POINTS 3 #else // !AUTO_BED_LEVELING_GRID From 35a08eeaeb230aba09c97947a56975f959ce0926 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:16:49 -0500 Subject: [PATCH 10/13] Use Z_HOME_DIR over axis_home_dir where we can --- Marlin/Marlin_main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 79d937d242..3d50936ddb 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2437,8 +2437,8 @@ static void homeaxis(AxisEnum axis) { home_dir(axis); // Homing Z towards the bed? Deploy the Z probe or endstop. - #if HAS_BED_PROBE && DISABLED(Z_MIN_PROBE_ENDSTOP) - if (axis == Z_AXIS && axis_home_dir < 0) { + #if HAS_BED_PROBE && Z_HOME_DIR < 0 && DISABLED(Z_MIN_PROBE_ENDSTOP) + if (axis == Z_AXIS) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> "); #endif @@ -2499,7 +2499,7 @@ static void homeaxis(AxisEnum axis) { #if ENABLED(DELTA) // retrace by the amount specified in endstop_adj - if (endstop_adj[axis] * axis_home_dir < 0) { + if (endstop_adj[axis] * Z_HOME_DIR < 0) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { SERIAL_ECHOPAIR("> endstop_adj = ", endstop_adj[axis]); @@ -2525,8 +2525,8 @@ static void homeaxis(AxisEnum axis) { axis_homed[axis] = true; // Put away the Z probe - #if HAS_BED_PROBE && DISABLED(Z_MIN_PROBE_ENDSTOP) - if (axis == Z_AXIS && axis_home_dir < 0) { + #if HAS_BED_PROBE && Z_HOME_DIR < 0 && DISABLED(Z_MIN_PROBE_ENDSTOP) + if (axis == Z_AXIS) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> "); #endif @@ -3636,7 +3636,7 @@ inline void gcode_G28() { #endif // !DELTA int probePointCounter = 0; - bool zig = (auto_bed_leveling_grid_points & 1) ? true : false; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION] + bool zig = auto_bed_leveling_grid_points & 1; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION] for (int yCount = 0; yCount < auto_bed_leveling_grid_points; yCount++) { float yBase = front_probe_bed_position + yGridSpacing * yCount, From d309a9647d4b7ffb09add4ec486fe23c1682938e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 01:17:56 -0500 Subject: [PATCH 11/13] Include probe offset for moving "close to the bed" --- Marlin/Marlin_main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 3d50936ddb..aa8e5e21c3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2162,9 +2162,14 @@ static void clean_up_after_endstop_or_probe_move() { // move up by the bump distance do_blocking_move_to_z(current_position[Z_AXIS] + home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_FAST)); + #else + // move fast, close to the bed - do_blocking_move_to_z(home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_FAST)); + float z = LOGICAL_Z_POSITION(home_bump_mm(Z_AXIS)); + if (zprobe_zoffset < 0) z -= zprobe_zoffset; + do_blocking_move_to_z(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); + #endif // move down slowly to find bed From 044f800be997ef2ddd1aa279d843562874613889 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 04:30:09 -0500 Subject: [PATCH 12/13] Use SERIAL_PROTOCOLLNPGM in G28 --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index aa8e5e21c3..0c64defb2a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3502,7 +3502,7 @@ inline void gcode_G28() { int verbose_level = code_seen('V') ? code_value_int() : 1; if (verbose_level < 0 || verbose_level > 4) { - SERIAL_ECHOLNPGM("?(V)erbose Level is implausible (0-4)."); + SERIAL_PROTOCOLLNPGM("?(V)erbose Level is implausible (0-4)."); return; } From 12d72363cb58d3afed33bb33d690c6aa6c4bc015 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Aug 2016 05:05:48 -0500 Subject: [PATCH 13/13] Do Delta radius check without sqrt --- 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 0c64defb2a..3fa9725d50 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3667,8 +3667,7 @@ inline void gcode_G28() { #if ENABLED(DELTA) // Avoid probing outside the round or hexagonal area of a delta printer - float distance_from_center = HYPOT(xProbe, yProbe); - if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue; + if (sq(xProbe) + sq(yProbe) > sq(DELTA_PROBEABLE_RADIUS)) continue; #endif float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);