Browse Source

Refactor 3-point auto bed leveling to use probe_pt()

Gabe Rosenhouse 11 years ago
parent
commit
c4fbb44d6d
1 changed files with 3 additions and 46 deletions
  1. 3
    46
      Marlin/Marlin_main.cpp

+ 3
- 46
Marlin/Marlin_main.cpp View File

@@ -1490,56 +1490,13 @@ void process_commands()
1490 1490
 
1491 1491
 
1492 1492
             // prob 1
1493
-            do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BEFORE_PROBING);
1494
-            do_blocking_move_to(LEFT_PROBE_BED_POSITION - X_PROBE_OFFSET_FROM_EXTRUDER, BACK_PROBE_BED_POSITION - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1495
-
1496
-            engage_z_probe();   // Engage Z Servo endstop if available
1497
-            run_z_probe();
1498
-            float z_at_xLeft_yBack = current_position[Z_AXIS];
1499
-            retract_z_probe();
1500
-
1501
-            SERIAL_PROTOCOLPGM("Bed x: ");
1502
-            SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION);
1503
-            SERIAL_PROTOCOLPGM(" y: ");
1504
-            SERIAL_PROTOCOL(BACK_PROBE_BED_POSITION);
1505
-            SERIAL_PROTOCOLPGM(" z: ");
1506
-            SERIAL_PROTOCOL(current_position[Z_AXIS]);
1507
-            SERIAL_PROTOCOLPGM("\n");
1493
+            float z_at_xLeft_yBack = probe_pt(LEFT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION, Z_RAISE_BEFORE_PROBING);
1508 1494
 
1509 1495
             // prob 2
1510
-            do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1511
-            do_blocking_move_to(LEFT_PROBE_BED_POSITION - X_PROBE_OFFSET_FROM_EXTRUDER, FRONT_PROBE_BED_POSITION - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1512
-
1513
-            engage_z_probe();   // Engage Z Servo endstop if available
1514
-            run_z_probe();
1515
-            float z_at_xLeft_yFront = current_position[Z_AXIS];
1516
-            retract_z_probe();
1517
-
1518
-            SERIAL_PROTOCOLPGM("Bed x: ");
1519
-            SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION);
1520
-            SERIAL_PROTOCOLPGM(" y: ");
1521
-            SERIAL_PROTOCOL(FRONT_PROBE_BED_POSITION);
1522
-            SERIAL_PROTOCOLPGM(" z: ");
1523
-            SERIAL_PROTOCOL(current_position[Z_AXIS]);
1524
-            SERIAL_PROTOCOLPGM("\n");
1496
+            float z_at_xLeft_yFront = probe_pt(LEFT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1525 1497
 
1526 1498
             // prob 3
1527
-            do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1528
-            // the current position will be updated by the blocking move so the head will not lower on this next call.
1529
-            do_blocking_move_to(RIGHT_PROBE_BED_POSITION - X_PROBE_OFFSET_FROM_EXTRUDER, FRONT_PROBE_BED_POSITION - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1530
-
1531
-            engage_z_probe();   // Engage Z Servo endstop if available
1532
-            run_z_probe();
1533
-            float z_at_xRight_yFront = current_position[Z_AXIS];
1534
-            retract_z_probe(); // Retract Z Servo endstop if available
1535
-
1536
-            SERIAL_PROTOCOLPGM("Bed x: ");
1537
-            SERIAL_PROTOCOL(RIGHT_PROBE_BED_POSITION);
1538
-            SERIAL_PROTOCOLPGM(" y: ");
1539
-            SERIAL_PROTOCOL(FRONT_PROBE_BED_POSITION);
1540
-            SERIAL_PROTOCOLPGM(" z: ");
1541
-            SERIAL_PROTOCOL(current_position[Z_AXIS]);
1542
-            SERIAL_PROTOCOLPGM("\n");
1499
+            float z_at_xRight_yFront = probe_pt(RIGHT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1543 1500
 
1544 1501
             clean_up_after_endstop_move();
1545 1502
 

Loading…
Cancel
Save