|
@@ -4190,7 +4190,7 @@ void home_all_axes() { gcode_G28(true); }
|
4190
|
4190
|
if (!g29_in_progress) {
|
4191
|
4191
|
|
4192
|
4192
|
#if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR)
|
4193
|
|
- abl_probe_index = 0;
|
|
4193
|
+ abl_probe_index = -1;
|
4194
|
4194
|
#endif
|
4195
|
4195
|
|
4196
|
4196
|
abl_should_enable = planner.abl_enabled;
|
|
@@ -4397,8 +4397,17 @@ void home_all_axes() { gcode_G28(true); }
|
4397
|
4397
|
|
4398
|
4398
|
#if ENABLED(PROBE_MANUALLY)
|
4399
|
4399
|
|
|
4400
|
+ const bool seenA = parser.seen('A'), seenQ = parser.seen('Q');
|
|
4401
|
+
|
|
4402
|
+ // For manual probing, get the next index to probe now.
|
|
4403
|
+ // On the first probe this will be incremented to 0.
|
|
4404
|
+ if (!seenA && !seenQ) {
|
|
4405
|
+ ++abl_probe_index;
|
|
4406
|
+ g29_in_progress = true;
|
|
4407
|
+ }
|
|
4408
|
+
|
4400
|
4409
|
// Abort current G29 procedure, go back to ABLStart
|
4401
|
|
- if (parser.seen('A') && g29_in_progress) {
|
|
4410
|
+ if (seenA && g29_in_progress) {
|
4402
|
4411
|
SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
|
4403
|
4412
|
#if HAS_SOFTWARE_ENDSTOPS
|
4404
|
4413
|
soft_endstops_enabled = enable_soft_endstops;
|
|
@@ -4408,7 +4417,7 @@ void home_all_axes() { gcode_G28(true); }
|
4408
|
4417
|
}
|
4409
|
4418
|
|
4410
|
4419
|
// Query G29 status
|
4411
|
|
- if (parser.seen('Q')) {
|
|
4420
|
+ if (verbose_level || seenQ) {
|
4412
|
4421
|
if (!g29_in_progress)
|
4413
|
4422
|
SERIAL_PROTOCOLLNPGM("Manual G29 idle");
|
4414
|
4423
|
else {
|
|
@@ -4417,10 +4426,7 @@ void home_all_axes() { gcode_G28(true); }
|
4417
|
4426
|
}
|
4418
|
4427
|
}
|
4419
|
4428
|
|
4420
|
|
- if (parser.seen('A') || parser.seen('Q')) return;
|
4421
|
|
-
|
4422
|
|
- // Fall through to probe the first point
|
4423
|
|
- g29_in_progress = true;
|
|
4429
|
+ if (seenA || seenQ) return;
|
4424
|
4430
|
|
4425
|
4431
|
if (abl_probe_index == 0) {
|
4426
|
4432
|
// For the initial G29 save software endstop state
|
|
@@ -4458,20 +4464,20 @@ void home_all_axes() { gcode_G28(true); }
|
4458
|
4464
|
|
4459
|
4465
|
#if ABL_GRID
|
4460
|
4466
|
|
4461
|
|
- // Find a next point to probe
|
4462
|
|
- // On the first G29 this will be the first probe point
|
|
4467
|
+ // Skip any unreachable points
|
4463
|
4468
|
while (abl_probe_index < abl2) {
|
4464
|
4469
|
|
4465
|
4470
|
// Set xCount, yCount based on abl_probe_index, with zig-zag
|
4466
|
4471
|
PR_OUTER_VAR = abl_probe_index / PR_INNER_END;
|
4467
|
4472
|
PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END);
|
4468
|
4473
|
|
4469
|
|
- bool zig = (PR_OUTER_VAR & 1) != ((PR_OUTER_END) & 1);
|
|
4474
|
+ // Probe in reverse order for every other row/column
|
|
4475
|
+ bool zig = (PR_OUTER_VAR & 1); // != ((PR_OUTER_END) & 1);
|
4470
|
4476
|
|
4471
|
4477
|
if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR;
|
4472
|
4478
|
|
4473
|
|
- const float xBase = left_probe_bed_position + xGridSpacing * xCount,
|
4474
|
|
- yBase = front_probe_bed_position + yGridSpacing * yCount;
|
|
4479
|
+ const float xBase = xCount * xGridSpacing + left_probe_bed_position,
|
|
4480
|
+ yBase = yCount * yGridSpacing + front_probe_bed_position;
|
4475
|
4481
|
|
4476
|
4482
|
xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5));
|
4477
|
4483
|
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
|
|
@@ -4488,7 +4494,6 @@ void home_all_axes() { gcode_G28(true); }
|
4488
|
4494
|
// Is there a next point to move to?
|
4489
|
4495
|
if (abl_probe_index < abl2) {
|
4490
|
4496
|
_manual_goto_xy(xProbe, yProbe); // Can be used here too!
|
4491
|
|
- ++abl_probe_index;
|
4492
|
4497
|
#if HAS_SOFTWARE_ENDSTOPS
|
4493
|
4498
|
// Disable software endstops to allow manual adjustment
|
4494
|
4499
|
// If G29 is not completed, they will not be re-enabled
|
|
@@ -4497,10 +4502,9 @@ void home_all_axes() { gcode_G28(true); }
|
4497
|
4502
|
return;
|
4498
|
4503
|
}
|
4499
|
4504
|
else {
|
4500
|
|
- // Then leveling is done!
|
4501
|
|
- // G29 finishing code goes here
|
4502
|
4505
|
|
4503
|
|
- // After recording the last point, activate abl
|
|
4506
|
+ // Leveling done! Fall through to G29 finishing code below
|
|
4507
|
+
|
4504
|
4508
|
SERIAL_PROTOCOLLNPGM("Grid probing done.");
|
4505
|
4509
|
g29_in_progress = false;
|
4506
|
4510
|
|
|
@@ -4514,9 +4518,8 @@ void home_all_axes() { gcode_G28(true); }
|
4514
|
4518
|
|
4515
|
4519
|
// Probe at 3 arbitrary points
|
4516
|
4520
|
if (abl_probe_index < 3) {
|
4517
|
|
- xProbe = LOGICAL_X_POSITION(points[i].x);
|
4518
|
|
- yProbe = LOGICAL_Y_POSITION(points[i].y);
|
4519
|
|
- ++abl_probe_index;
|
|
4521
|
+ xProbe = LOGICAL_X_POSITION(points[abl_probe_index].x);
|
|
4522
|
+ yProbe = LOGICAL_Y_POSITION(points[abl_probe_index].y);
|
4520
|
4523
|
#if HAS_SOFTWARE_ENDSTOPS
|
4521
|
4524
|
// Disable software endstops to allow manual adjustment
|
4522
|
4525
|
// If G29 is not completed, they will not be re-enabled
|
|
@@ -4587,7 +4590,7 @@ void home_all_axes() { gcode_G28(true); }
|
4587
|
4590
|
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
|
4588
|
4591
|
|
4589
|
4592
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
4590
|
|
- indexIntoAB[xCount][yCount] = ++abl_probe_index;
|
|
4593
|
+ indexIntoAB[xCount][yCount] = ++abl_probe_index; // 0...
|
4591
|
4594
|
#endif
|
4592
|
4595
|
|
4593
|
4596
|
#if IS_KINEMATIC
|
|
@@ -4665,7 +4668,10 @@ void home_all_axes() { gcode_G28(true); }
|
4665
|
4668
|
// G29 Finishing Code
|
4666
|
4669
|
//
|
4667
|
4670
|
// Unless this is a dry run, auto bed leveling will
|
4668
|
|
- // definitely be enabled after this point
|
|
4671
|
+ // definitely be enabled after this point.
|
|
4672
|
+ //
|
|
4673
|
+ // If code above wants to continue leveling, it should
|
|
4674
|
+ // return or loop before this point.
|
4669
|
4675
|
//
|
4670
|
4676
|
|
4671
|
4677
|
// Restore state after probing
|