Browse Source

Merge pull request #6858 from thinkyhead/bf_leveling_patch

Fixes for PROBE_MANUALLY and LCD_BED_LEVELING
Scott Lahteine 8 years ago
parent
commit
73ed0c63b4
4 changed files with 468 additions and 492 deletions
  1. 1
    0
      .gitignore
  2. 47
    25
      Marlin/Marlin_main.cpp
  3. 4
    4
      Marlin/configuration_store.cpp
  4. 416
    463
      Marlin/ultralcd.cpp

+ 1
- 0
.gitignore View File

@@ -52,6 +52,7 @@ tags
52 52
 *.lo
53 53
 *.o
54 54
 *.obj
55
+*.ino.cpp
55 56
 
56 57
 # Precompiled Headers
57 58
 *.gch

+ 47
- 25
Marlin/Marlin_main.cpp View File

@@ -3800,6 +3800,10 @@ void home_all_axes() { gcode_G28(true); }
3800 3800
 
3801 3801
 #if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
3802 3802
 
3803
+  #if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
3804
+    extern bool lcd_wait_for_move;
3805
+  #endif
3806
+
3803 3807
   inline void _manual_goto_xy(const float &x, const float &y) {
3804 3808
     const float old_feedrate_mm_s = feedrate_mm_s;
3805 3809
 
@@ -3822,6 +3826,10 @@ void home_all_axes() { gcode_G28(true); }
3822 3826
 
3823 3827
     feedrate_mm_s = old_feedrate_mm_s;
3824 3828
     stepper.synchronize();
3829
+
3830
+    #if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
3831
+      lcd_wait_for_move = false;
3832
+    #endif
3825 3833
   }
3826 3834
 
3827 3835
 #endif
@@ -4190,7 +4198,7 @@ void home_all_axes() { gcode_G28(true); }
4190 4198
     if (!g29_in_progress) {
4191 4199
 
4192 4200
       #if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR)
4193
-        abl_probe_index = 0;
4201
+        abl_probe_index = -1;
4194 4202
       #endif
4195 4203
 
4196 4204
       abl_should_enable = planner.abl_enabled;
@@ -4397,30 +4405,40 @@ void home_all_axes() { gcode_G28(true); }
4397 4405
 
4398 4406
     #if ENABLED(PROBE_MANUALLY)
4399 4407
 
4408
+      const bool seenA = parser.seen('A'), seenQ = parser.seen('Q');
4409
+
4410
+      // For manual probing, get the next index to probe now.
4411
+      // On the first probe this will be incremented to 0.
4412
+      if (!seenA && !seenQ) {
4413
+        ++abl_probe_index;
4414
+        g29_in_progress = true;
4415
+      }
4416
+
4400 4417
       // Abort current G29 procedure, go back to ABLStart
4401
-      if (parser.seen('A') && g29_in_progress) {
4418
+      if (seenA && g29_in_progress) {
4402 4419
         SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
4403 4420
         #if HAS_SOFTWARE_ENDSTOPS
4404 4421
           soft_endstops_enabled = enable_soft_endstops;
4405 4422
         #endif
4406 4423
         planner.abl_enabled = abl_should_enable;
4407 4424
         g29_in_progress = false;
4425
+        #if ENABLED(LCD_BED_LEVELING)
4426
+          lcd_wait_for_move = false;
4427
+        #endif
4408 4428
       }
4409 4429
 
4410 4430
       // Query G29 status
4411
-      if (parser.seen('Q')) {
4412
-        if (!g29_in_progress)
4413
-          SERIAL_PROTOCOLLNPGM("Manual G29 idle");
4414
-        else {
4415
-          SERIAL_PROTOCOLPAIR("Manual G29 point ", abl_probe_index + 1);
4431
+      if (verbose_level || seenQ) {
4432
+        SERIAL_PROTOCOLPGM("Manual G29 ");
4433
+        if (g29_in_progress) {
4434
+          SERIAL_PROTOCOLPAIR("point ", abl_probe_index + 1);
4416 4435
           SERIAL_PROTOCOLLNPAIR(" of ", abl2);
4417 4436
         }
4437
+        else
4438
+          SERIAL_PROTOCOLLNPGM("idle");
4418 4439
       }
4419 4440
 
4420
-      if (parser.seen('A') || parser.seen('Q')) return;
4421
-
4422
-      // Fall through to probe the first point
4423
-      g29_in_progress = true;
4441
+      if (seenA || seenQ) return;
4424 4442
 
4425 4443
       if (abl_probe_index == 0) {
4426 4444
         // For the initial G29 save software endstop state
@@ -4458,20 +4476,20 @@ void home_all_axes() { gcode_G28(true); }
4458 4476
 
4459 4477
       #if ABL_GRID
4460 4478
 
4461
-        // Find a next point to probe
4462
-        // On the first G29 this will be the first probe point
4479
+        // Skip any unreachable points
4463 4480
         while (abl_probe_index < abl2) {
4464 4481
 
4465 4482
           // Set xCount, yCount based on abl_probe_index, with zig-zag
4466 4483
           PR_OUTER_VAR = abl_probe_index / PR_INNER_END;
4467 4484
           PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END);
4468 4485
 
4469
-          bool zig = (PR_OUTER_VAR & 1) != ((PR_OUTER_END) & 1);
4486
+          // Probe in reverse order for every other row/column
4487
+          bool zig = (PR_OUTER_VAR & 1); // != ((PR_OUTER_END) & 1);
4470 4488
 
4471 4489
           if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR;
4472 4490
 
4473
-          const float xBase = left_probe_bed_position + xGridSpacing * xCount,
4474
-                      yBase = front_probe_bed_position + yGridSpacing * yCount;
4491
+          const float xBase = xCount * xGridSpacing + left_probe_bed_position,
4492
+                      yBase = yCount * yGridSpacing + front_probe_bed_position;
4475 4493
 
4476 4494
           xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5));
4477 4495
           yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
@@ -4488,7 +4506,6 @@ void home_all_axes() { gcode_G28(true); }
4488 4506
         // Is there a next point to move to?
4489 4507
         if (abl_probe_index < abl2) {
4490 4508
           _manual_goto_xy(xProbe, yProbe); // Can be used here too!
4491
-          ++abl_probe_index;
4492 4509
           #if HAS_SOFTWARE_ENDSTOPS
4493 4510
             // Disable software endstops to allow manual adjustment
4494 4511
             // If G29 is not completed, they will not be re-enabled
@@ -4497,10 +4514,9 @@ void home_all_axes() { gcode_G28(true); }
4497 4514
           return;
4498 4515
         }
4499 4516
         else {
4500
-          // Then leveling is done!
4501
-          // G29 finishing code goes here
4502 4517
 
4503
-          // After recording the last point, activate abl
4518
+          // Leveling done! Fall through to G29 finishing code below
4519
+
4504 4520
           SERIAL_PROTOCOLLNPGM("Grid probing done.");
4505 4521
           g29_in_progress = false;
4506 4522
 
@@ -4514,9 +4530,8 @@ void home_all_axes() { gcode_G28(true); }
4514 4530
 
4515 4531
         // Probe at 3 arbitrary points
4516 4532
         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;
4533
+          xProbe = LOGICAL_X_POSITION(points[abl_probe_index].x);
4534
+          yProbe = LOGICAL_Y_POSITION(points[abl_probe_index].y);
4520 4535
           #if HAS_SOFTWARE_ENDSTOPS
4521 4536
             // Disable software endstops to allow manual adjustment
4522 4537
             // If G29 is not completed, they will not be re-enabled
@@ -4587,7 +4602,7 @@ void home_all_axes() { gcode_G28(true); }
4587 4602
             yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
4588 4603
 
4589 4604
             #if ENABLED(AUTO_BED_LEVELING_LINEAR)
4590
-              indexIntoAB[xCount][yCount] = ++abl_probe_index;
4605
+              indexIntoAB[xCount][yCount] = ++abl_probe_index; // 0...
4591 4606
             #endif
4592 4607
 
4593 4608
             #if IS_KINEMATIC
@@ -4665,7 +4680,10 @@ void home_all_axes() { gcode_G28(true); }
4665 4680
     // G29 Finishing Code
4666 4681
     //
4667 4682
     // Unless this is a dry run, auto bed leveling will
4668
-    // definitely be enabled after this point
4683
+    // definitely be enabled after this point.
4684
+    //
4685
+    // If code above wants to continue leveling, it should
4686
+    // return or loop before this point.
4669 4687
     //
4670 4688
 
4671 4689
     // Restore state after probing
@@ -4675,6 +4693,10 @@ void home_all_axes() { gcode_G28(true); }
4675 4693
       if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
4676 4694
     #endif
4677 4695
 
4696
+    #if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
4697
+      lcd_wait_for_move = false;
4698
+    #endif
4699
+
4678 4700
     // Calculate leveling, print reports, correct the position
4679 4701
     #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
4680 4702
 

+ 4
- 4
Marlin/configuration_store.cpp View File

@@ -1344,9 +1344,8 @@ void MarlinSettings::reset() {
1344 1344
     #else
1345 1345
       #define LINEAR_UNIT(N) N
1346 1346
       #define VOLUMETRIC_UNIT(N) N
1347
-      SERIAL_ECHOLNPGM("  G21 ; Units in mm\n");
1347
+      SERIAL_ECHOLNPGM("  G21    ; Units in mm");
1348 1348
     #endif
1349
-    SERIAL_EOL;
1350 1349
 
1351 1350
     #if ENABLED(ULTIPANEL)
1352 1351
 
@@ -1361,12 +1360,13 @@ void MarlinSettings::reset() {
1361 1360
         serialprintPGM(parser.temp_units_name());
1362 1361
       #else
1363 1362
         #define TEMP_UNIT(N) N
1364
-        SERIAL_ECHOLNPGM("  M149 C ; Units in Celsius\n");
1363
+        SERIAL_ECHOLNPGM("  M149 C ; Units in Celsius");
1365 1364
       #endif
1366
-      SERIAL_EOL;
1367 1365
 
1368 1366
     #endif
1369 1367
 
1368
+    SERIAL_EOL;
1369
+
1370 1370
     /**
1371 1371
      * Volumetric extrusion M200
1372 1372
      */

+ 416
- 463
Marlin/ultralcd.cpp
File diff suppressed because it is too large
View File


Loading…
Cancel
Save