Merge pull request #4651 from thinkyhead/rc_homing_vs_leveling_z
Improvements to homing / leveling
This commit is contained in:
		
						commit
						4d4c00d69c
					
				| @ -689,7 +689,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -379,6 +379,7 @@ extern uint8_t active_extruder; | |||||||
|   extern float mixing_factor[MIXING_STEPPERS]; |   extern float mixing_factor[MIXING_STEPPERS]; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | void update_software_endstops(AxisEnum axis); | ||||||
| void calculate_volumetric_multipliers(); | void calculate_volumetric_multipliers(); | ||||||
| 
 | 
 | ||||||
| // Buzzer
 | // Buzzer
 | ||||||
|  | |||||||
| @ -1470,7 +1470,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); | |||||||
|  * the software endstop positions must be refreshed to remain |  * the software endstop positions must be refreshed to remain | ||||||
|  * at the same positions relative to the machine. |  * 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); |   float offs = LOGICAL_POSITION(0, axis); | ||||||
| 
 | 
 | ||||||
|   #if ENABLED(DUAL_X_CARRIAGE) |   #if ENABLED(DUAL_X_CARRIAGE) | ||||||
| @ -1530,7 +1530,7 @@ static void set_home_offset(AxisEnum axis, float v) { | |||||||
| static void set_axis_is_at_home(AxisEnum axis) { | static void set_axis_is_at_home(AxisEnum axis) { | ||||||
|   #if ENABLED(DEBUG_LEVELING_FEATURE) |   #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||||
|     if (DEBUGGING(LEVELING)) { |     if (DEBUGGING(LEVELING)) { | ||||||
|       SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis); |       SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis_codes[axis]); | ||||||
|       SERIAL_ECHOLNPGM(")"); |       SERIAL_ECHOLNPGM(")"); | ||||||
|     } |     } | ||||||
|   #endif |   #endif | ||||||
| @ -1606,7 +1606,7 @@ static void set_axis_is_at_home(AxisEnum axis) { | |||||||
|   } |   } | ||||||
|   #if ENABLED(DEBUG_LEVELING_FEATURE) |   #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||||
|     if (DEBUGGING(LEVELING)) { |     if (DEBUGGING(LEVELING)) { | ||||||
|       SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis); |       SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]); | ||||||
|       SERIAL_ECHOLNPGM(")"); |       SERIAL_ECHOLNPGM(")"); | ||||||
|     } |     } | ||||||
|   #endif |   #endif | ||||||
| @ -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); |   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
 | // line_to_destination
 | ||||||
| // Move the planner, not necessarily synced with current_position
 | // Move the planner, not necessarily synced with current_position
 | ||||||
| @ -2127,10 +2118,36 @@ static void clean_up_after_endstop_or_probe_move() { | |||||||
|     return false; |     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]
 |   // Do a single Z probe and return with current_position[Z_AXIS]
 | ||||||
|   // at the height where the probe triggered.
 |   // at the height where the probe triggered.
 | ||||||
|   static float run_z_probe() { |   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
 |     // Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
 | ||||||
|     refresh_cmd_timeout(); |     refresh_cmd_timeout(); | ||||||
| 
 | 
 | ||||||
| @ -2139,26 +2156,27 @@ static void clean_up_after_endstop_or_probe_move() { | |||||||
|     #endif |     #endif | ||||||
| 
 | 
 | ||||||
|     #if ENABLED(PROBE_DOUBLE_TOUCH) |     #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)); |       do_blocking_move_to_z(current_position[Z_AXIS] + home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_FAST)); | ||||||
|  | 
 | ||||||
|     #else |     #else | ||||||
|  | 
 | ||||||
|       // move fast, close to the bed
 |       // 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 |     #endif | ||||||
| 
 | 
 | ||||||
|     // move down slowly to find bed
 |     // 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)); |     do_probe_move(-10, Z_PROBE_SPEED_SLOW); | ||||||
|     endstops.hit_on_purpose(); |  | ||||||
|     set_current_from_steppers_for_axis(Z_AXIS); |  | ||||||
|     SYNC_PLAN_POSITION_KINEMATIC(); |  | ||||||
| 
 | 
 | ||||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) |     #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 |     #endif | ||||||
| 
 | 
 | ||||||
|     return current_position[Z_AXIS]; |     return current_position[Z_AXIS]; | ||||||
| @ -2393,6 +2411,15 @@ static void clean_up_after_endstop_or_probe_move() { | |||||||
|  * Home an individual axis |  * 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) | #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) | ||||||
| 
 | 
 | ||||||
| static void homeaxis(AxisEnum axis) { | static void homeaxis(AxisEnum axis) { | ||||||
| @ -2403,7 +2430,7 @@ static void homeaxis(AxisEnum axis) { | |||||||
| 
 | 
 | ||||||
|   #if ENABLED(DEBUG_LEVELING_FEATURE) |   #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||||
|     if (DEBUGGING(LEVELING)) { |     if (DEBUGGING(LEVELING)) { | ||||||
|       SERIAL_ECHOPAIR(">>> homeaxis(", axis); |       SERIAL_ECHOPAIR(">>> homeaxis(", axis_codes[axis]); | ||||||
|       SERIAL_ECHOLNPGM(")"); |       SERIAL_ECHOLNPGM(")"); | ||||||
|     } |     } | ||||||
|   #endif |   #endif | ||||||
| @ -2415,8 +2442,8 @@ static void homeaxis(AxisEnum axis) { | |||||||
|     home_dir(axis); |     home_dir(axis); | ||||||
| 
 | 
 | ||||||
|   // Homing Z towards the bed? Deploy the Z probe or endstop.
 |   // Homing Z towards the bed? Deploy the Z probe or endstop.
 | ||||||
|   #if HAS_BED_PROBE && DISABLED(Z_MIN_PROBE_ENDSTOP) |   #if HAS_BED_PROBE && Z_HOME_DIR < 0 && DISABLED(Z_MIN_PROBE_ENDSTOP) | ||||||
|     if (axis == Z_AXIS && axis_home_dir < 0) { |     if (axis == Z_AXIS) { | ||||||
|       #if ENABLED(DEBUG_LEVELING_FEATURE) |       #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||||
|         if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> "); |         if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> "); | ||||||
|       #endif |       #endif | ||||||
| @ -2434,17 +2461,17 @@ static void homeaxis(AxisEnum axis) { | |||||||
|   #endif |   #endif | ||||||
| 
 | 
 | ||||||
|   // Move towards the endstop until an endstop is triggered
 |   // 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
 |   // Set the axis position as setup for the move
 | ||||||
|   current_position[axis] = 0; |   current_position[axis] = 0; | ||||||
|   sync_plan_position(); |   sync_plan_position(); | ||||||
| 
 | 
 | ||||||
|   // Move away from the endstop by the axis HOME_BUMP_MM
 |   // 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
 |   // 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
 |   // reset current_position to 0 to reflect hitting endpoint
 | ||||||
|   current_position[axis] = 0; |   current_position[axis] = 0; | ||||||
| @ -2468,7 +2495,7 @@ static void homeaxis(AxisEnum axis) { | |||||||
|       if (lockZ1) stepper.set_z_lock(true); else stepper.set_z2_lock(true); |       if (lockZ1) stepper.set_z_lock(true); else stepper.set_z2_lock(true); | ||||||
| 
 | 
 | ||||||
|       // Move to the adjusted endstop height
 |       // 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); |       if (lockZ1) stepper.set_z_lock(false); else stepper.set_z2_lock(false); | ||||||
|       stepper.set_homing_flag(false); |       stepper.set_homing_flag(false); | ||||||
| @ -2477,14 +2504,14 @@ static void homeaxis(AxisEnum axis) { | |||||||
| 
 | 
 | ||||||
|   #if ENABLED(DELTA) |   #if ENABLED(DELTA) | ||||||
|     // retrace by the amount specified in endstop_adj
 |     // 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 ENABLED(DEBUG_LEVELING_FEATURE) | ||||||
|         if (DEBUGGING(LEVELING)) { |         if (DEBUGGING(LEVELING)) { | ||||||
|           SERIAL_ECHOPAIR("> endstop_adj = ", endstop_adj[axis]); |           SERIAL_ECHOPAIR("> endstop_adj = ", endstop_adj[axis]); | ||||||
|           DEBUG_POS("", current_position); |           DEBUG_POS("", current_position); | ||||||
|         } |         } | ||||||
|       #endif |       #endif | ||||||
|       line_to_axis_pos(axis, endstop_adj[axis]); |       do_homing_move(axis, endstop_adj[axis]); | ||||||
|     } |     } | ||||||
|   #endif |   #endif | ||||||
| 
 | 
 | ||||||
| @ -2503,8 +2530,8 @@ static void homeaxis(AxisEnum axis) { | |||||||
|   axis_homed[axis] = true; |   axis_homed[axis] = true; | ||||||
| 
 | 
 | ||||||
|   // Put away the Z probe
 |   // Put away the Z probe
 | ||||||
|   #if HAS_BED_PROBE && DISABLED(Z_MIN_PROBE_ENDSTOP) |   #if HAS_BED_PROBE && Z_HOME_DIR < 0 && DISABLED(Z_MIN_PROBE_ENDSTOP) | ||||||
|     if (axis == Z_AXIS && axis_home_dir < 0) { |     if (axis == Z_AXIS) { | ||||||
|       #if ENABLED(DEBUG_LEVELING_FEATURE) |       #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||||
|         if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> "); |         if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> "); | ||||||
|       #endif |       #endif | ||||||
| @ -2514,11 +2541,11 @@ static void homeaxis(AxisEnum axis) { | |||||||
| 
 | 
 | ||||||
|   #if ENABLED(DEBUG_LEVELING_FEATURE) |   #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||||
|     if (DEBUGGING(LEVELING)) { |     if (DEBUGGING(LEVELING)) { | ||||||
|       SERIAL_ECHOPAIR("<<< homeaxis(", axis); |       SERIAL_ECHOPAIR("<<< homeaxis(", axis_codes[axis]); | ||||||
|       SERIAL_ECHOLNPGM(")"); |       SERIAL_ECHOLNPGM(")"); | ||||||
|     } |     } | ||||||
|   #endif |   #endif | ||||||
| } | } // homeaxis()
 | ||||||
| 
 | 
 | ||||||
| #if ENABLED(FWRETRACT) | #if ENABLED(FWRETRACT) | ||||||
| 
 | 
 | ||||||
| @ -3475,7 +3502,7 @@ inline void gcode_G28() { | |||||||
| 
 | 
 | ||||||
|     int verbose_level = code_seen('V') ? code_value_int() : 1; |     int verbose_level = code_seen('V') ? code_value_int() : 1; | ||||||
|     if (verbose_level < 0 || verbose_level > 4) { |     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; |       return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -3587,12 +3614,12 @@ inline void gcode_G28() { | |||||||
|     #if ENABLED(AUTO_BED_LEVELING_GRID) |     #if ENABLED(AUTO_BED_LEVELING_GRID) | ||||||
| 
 | 
 | ||||||
|       // probe at the points of a lattice 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), |       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); |                   yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1); | ||||||
| 
 | 
 | ||||||
|       #if ENABLED(DELTA) |       #if ENABLED(DELTA) | ||||||
|         delta_grid_spacing[0] = xGridSpacing; |         delta_grid_spacing[X_AXIS] = xGridSpacing; | ||||||
|         delta_grid_spacing[1] = yGridSpacing; |         delta_grid_spacing[Y_AXIS] = yGridSpacing; | ||||||
|         float zoffset = zprobe_zoffset; |         float zoffset = zprobe_zoffset; | ||||||
|         if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS); |         if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS); | ||||||
|       #else // !DELTA
 |       #else // !DELTA
 | ||||||
| @ -3614,10 +3641,11 @@ inline void gcode_G28() { | |||||||
|       #endif // !DELTA
 |       #endif // !DELTA
 | ||||||
| 
 | 
 | ||||||
|       int probePointCounter = 0; |       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++) { |       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; |         int xStart, xStop, xInc; | ||||||
| 
 | 
 | ||||||
|         if (zig) { |         if (zig) { | ||||||
| @ -3634,13 +3662,13 @@ inline void gcode_G28() { | |||||||
|         zig = !zig; |         zig = !zig; | ||||||
| 
 | 
 | ||||||
|         for (int xCount = xStart; xCount != xStop; xCount += xInc) { |         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) |           #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 (sq(xProbe) + sq(yProbe) > sq(DELTA_PROBEABLE_RADIUS)) continue; | ||||||
|             if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue; |           #endif | ||||||
|           #endif //DELTA
 |  | ||||||
| 
 | 
 | ||||||
|           float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); |           float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); | ||||||
| 
 | 
 | ||||||
| @ -7875,12 +7903,12 @@ void clamp_to_software_endstops(float target[3]) { | |||||||
| 
 | 
 | ||||||
|     // Adjust print surface height by linear interpolation over the bed_level array.
 |     // Adjust print surface height by linear interpolation over the bed_level array.
 | ||||||
|     void adjust_delta(float cartesian[3]) { |     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; |       int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2; | ||||||
|       float h1 = 0.001 - half, h2 = half - 0.001, |       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_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[1])); |             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); |       int floor_x = floor(grid_x), floor_y = floor(grid_y); | ||||||
|       float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y, |       float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y, | ||||||
|             z1 = bed_level[floor_x + half][floor_y + half], |             z1 = bed_level[floor_x + half][floor_y + half], | ||||||
|  | |||||||
| @ -191,6 +191,13 @@ | |||||||
|   #if DISABLED(USE_XMAX_PLUG) && DISABLED(USE_YMAX_PLUG) && DISABLED(USE_ZMAX_PLUG) |   #if DISABLED(USE_XMAX_PLUG) && DISABLED(USE_YMAX_PLUG) && DISABLED(USE_ZMAX_PLUG) | ||||||
|     #error "You probably want to use Max Endstops for DELTA!" |     #error "You probably want to use Max Endstops for DELTA!" | ||||||
|   #endif |   #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 | #endif | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  | |||||||
| @ -186,6 +186,9 @@ void Config_Postprocess() { | |||||||
|   #endif |   #endif | ||||||
| 
 | 
 | ||||||
|   calculate_volumetric_multipliers(); |   calculate_volumetric_multipliers(); | ||||||
|  | 
 | ||||||
|  |   // Software endstops depend on home_offset
 | ||||||
|  |   LOOP_XYZ(i) update_software_endstops((AxisEnum)i); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLED(EEPROM_SETTINGS) | #if ENABLED(EEPROM_SETTINGS) | ||||||
|  | |||||||
| @ -689,7 +689,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -671,7 +671,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -669,7 +669,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -681,7 +681,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -683,7 +683,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -706,7 +706,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -689,7 +689,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -689,7 +689,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -689,7 +689,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -686,7 +686,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -697,7 +697,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -710,7 +710,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -681,7 +681,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -689,7 +689,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -692,7 +692,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -679,7 +679,7 @@ | |||||||
| 
 | 
 | ||||||
|     // Set the number of grid points per dimension.
 |     // Set the number of grid points per dimension.
 | ||||||
|     // You probably don't need more than 3 (squared=9).
 |     // 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
 |   #else  // !AUTO_BED_LEVELING_GRID
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user