|
|
@ -3800,6 +3800,10 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
|
|
|
|
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY) |
|
|
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING) |
|
|
|
extern bool lcd_wait_for_move; |
|
|
|
#endif |
|
|
|
|
|
|
|
inline void _manual_goto_xy(const float &x, const float &y) { |
|
|
|
const float old_feedrate_mm_s = feedrate_mm_s; |
|
|
|
|
|
|
@ -3822,6 +3826,10 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
|
|
|
|
feedrate_mm_s = old_feedrate_mm_s; |
|
|
|
stepper.synchronize(); |
|
|
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING) |
|
|
|
lcd_wait_for_move = false; |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
@ -4190,7 +4198,7 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
if (!g29_in_progress) { |
|
|
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR) |
|
|
|
abl_probe_index = 0; |
|
|
|
abl_probe_index = -1; |
|
|
|
#endif |
|
|
|
|
|
|
|
abl_should_enable = planner.abl_enabled; |
|
|
@ -4397,30 +4405,40 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY) |
|
|
|
|
|
|
|
const bool seenA = parser.seen('A'), seenQ = parser.seen('Q'); |
|
|
|
|
|
|
|
// For manual probing, get the next index to probe now.
|
|
|
|
// On the first probe this will be incremented to 0.
|
|
|
|
if (!seenA && !seenQ) { |
|
|
|
++abl_probe_index; |
|
|
|
g29_in_progress = true; |
|
|
|
} |
|
|
|
|
|
|
|
// Abort current G29 procedure, go back to ABLStart
|
|
|
|
if (parser.seen('A') && g29_in_progress) { |
|
|
|
if (seenA && g29_in_progress) { |
|
|
|
SERIAL_PROTOCOLLNPGM("Manual G29 aborted"); |
|
|
|
#if HAS_SOFTWARE_ENDSTOPS |
|
|
|
soft_endstops_enabled = enable_soft_endstops; |
|
|
|
#endif |
|
|
|
planner.abl_enabled = abl_should_enable; |
|
|
|
g29_in_progress = false; |
|
|
|
#if ENABLED(LCD_BED_LEVELING) |
|
|
|
lcd_wait_for_move = false; |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
// Query G29 status
|
|
|
|
if (parser.seen('Q')) { |
|
|
|
if (!g29_in_progress) |
|
|
|
SERIAL_PROTOCOLLNPGM("Manual G29 idle"); |
|
|
|
else { |
|
|
|
SERIAL_PROTOCOLPAIR("Manual G29 point ", abl_probe_index + 1); |
|
|
|
if (verbose_level || seenQ) { |
|
|
|
SERIAL_PROTOCOLPGM("Manual G29 "); |
|
|
|
if (g29_in_progress) { |
|
|
|
SERIAL_PROTOCOLPAIR("point ", abl_probe_index + 1); |
|
|
|
SERIAL_PROTOCOLLNPAIR(" of ", abl2); |
|
|
|
} |
|
|
|
else |
|
|
|
SERIAL_PROTOCOLLNPGM("idle"); |
|
|
|
} |
|
|
|
|
|
|
|
if (parser.seen('A') || parser.seen('Q')) return; |
|
|
|
|
|
|
|
// Fall through to probe the first point
|
|
|
|
g29_in_progress = true; |
|
|
|
if (seenA || seenQ) return; |
|
|
|
|
|
|
|
if (abl_probe_index == 0) { |
|
|
|
// For the initial G29 save software endstop state
|
|
|
@ -4458,20 +4476,20 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
|
|
|
|
#if ABL_GRID |
|
|
|
|
|
|
|
// Find a next point to probe
|
|
|
|
// On the first G29 this will be the first probe point
|
|
|
|
// Skip any unreachable points
|
|
|
|
while (abl_probe_index < abl2) { |
|
|
|
|
|
|
|
// Set xCount, yCount based on abl_probe_index, with zig-zag
|
|
|
|
PR_OUTER_VAR = abl_probe_index / PR_INNER_END; |
|
|
|
PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END); |
|
|
|
|
|
|
|
bool zig = (PR_OUTER_VAR & 1) != ((PR_OUTER_END) & 1); |
|
|
|
// Probe in reverse order for every other row/column
|
|
|
|
bool zig = (PR_OUTER_VAR & 1); // != ((PR_OUTER_END) & 1);
|
|
|
|
|
|
|
|
if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR; |
|
|
|
|
|
|
|
const float xBase = left_probe_bed_position + xGridSpacing * xCount, |
|
|
|
yBase = front_probe_bed_position + yGridSpacing * yCount; |
|
|
|
const float xBase = xCount * xGridSpacing + left_probe_bed_position, |
|
|
|
yBase = yCount * yGridSpacing + front_probe_bed_position; |
|
|
|
|
|
|
|
xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5)); |
|
|
|
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5)); |
|
|
@ -4488,7 +4506,6 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
// Is there a next point to move to?
|
|
|
|
if (abl_probe_index < abl2) { |
|
|
|
_manual_goto_xy(xProbe, yProbe); // Can be used here too!
|
|
|
|
++abl_probe_index; |
|
|
|
#if HAS_SOFTWARE_ENDSTOPS |
|
|
|
// Disable software endstops to allow manual adjustment
|
|
|
|
// If G29 is not completed, they will not be re-enabled
|
|
|
@ -4497,10 +4514,9 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
return; |
|
|
|
} |
|
|
|
else { |
|
|
|
// Then leveling is done!
|
|
|
|
// G29 finishing code goes here
|
|
|
|
|
|
|
|
// After recording the last point, activate abl
|
|
|
|
// Leveling done! Fall through to G29 finishing code below
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("Grid probing done."); |
|
|
|
g29_in_progress = false; |
|
|
|
|
|
|
@ -4514,9 +4530,8 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
|
|
|
|
// Probe at 3 arbitrary points
|
|
|
|
if (abl_probe_index < 3) { |
|
|
|
xProbe = LOGICAL_X_POSITION(points[i].x); |
|
|
|
yProbe = LOGICAL_Y_POSITION(points[i].y); |
|
|
|
++abl_probe_index; |
|
|
|
xProbe = LOGICAL_X_POSITION(points[abl_probe_index].x); |
|
|
|
yProbe = LOGICAL_Y_POSITION(points[abl_probe_index].y); |
|
|
|
#if HAS_SOFTWARE_ENDSTOPS |
|
|
|
// Disable software endstops to allow manual adjustment
|
|
|
|
// If G29 is not completed, they will not be re-enabled
|
|
|
@ -4587,7 +4602,7 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5)); |
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR) |
|
|
|
indexIntoAB[xCount][yCount] = ++abl_probe_index; |
|
|
|
indexIntoAB[xCount][yCount] = ++abl_probe_index; // 0...
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if IS_KINEMATIC |
|
|
@ -4665,7 +4680,10 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
// G29 Finishing Code
|
|
|
|
//
|
|
|
|
// Unless this is a dry run, auto bed leveling will
|
|
|
|
// definitely be enabled after this point
|
|
|
|
// definitely be enabled after this point.
|
|
|
|
//
|
|
|
|
// If code above wants to continue leveling, it should
|
|
|
|
// return or loop before this point.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Restore state after probing
|
|
|
@ -4675,6 +4693,10 @@ void home_all_axes() { gcode_G28(true); } |
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING) |
|
|
|
lcd_wait_for_move = false; |
|
|
|
#endif |
|
|
|
|
|
|
|
// Calculate leveling, print reports, correct the position
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) |
|
|
|
|
|
|
|