Browse Source

Add probe_pt(), useful for auto bed leveling

Gabe Rosenhouse 11 years ago
parent
commit
ad2c6488c7
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      Marlin/Marlin_main.cpp

+ 21
- 0
Marlin/Marlin_main.cpp View File

@@ -978,6 +978,27 @@ static void retract_z_probe() {
978 978
     #endif
979 979
 }
980 980
 
981
+/// Probe bed height at position (x,y), returns the measured z value
982
+static float probe_pt(float x, float y, float z_before) {
983
+  // move to right place
984
+  do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
985
+  do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
986
+
987
+  engage_z_probe();   // Engage Z Servo endstop if available
988
+  run_z_probe();
989
+  float measured_z = current_position[Z_AXIS];
990
+  retract_z_probe();
991
+
992
+  SERIAL_PROTOCOLPGM("Bed x: ");
993
+  SERIAL_PROTOCOL(x);
994
+  SERIAL_PROTOCOLPGM(" y: ");
995
+  SERIAL_PROTOCOL(y);
996
+  SERIAL_PROTOCOLPGM(" z: ");
997
+  SERIAL_PROTOCOL(measured_z);
998
+  SERIAL_PROTOCOLPGM("\n");
999
+  return measured_z;
1000
+}
1001
+
981 1002
 #endif // #ifdef ENABLE_AUTO_BED_LEVELING
982 1003
 
983 1004
 static void homeaxis(int axis) {

Loading…
Cancel
Save