From c4fbb44d6d42b84137a89ab7aa5ab7143116184d Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Sun, 16 Feb 2014 10:40:36 -0800 Subject: [PATCH] Refactor 3-point auto bed leveling to use probe_pt() --- Marlin/Marlin_main.cpp | 49 +++--------------------------------------- 1 file changed, 3 insertions(+), 46 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5152dc9532..783b6da76c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1490,56 +1490,13 @@ void process_commands() // prob 1 - do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BEFORE_PROBING); - 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]); - - engage_z_probe(); // Engage Z Servo endstop if available - run_z_probe(); - float z_at_xLeft_yBack = current_position[Z_AXIS]; - retract_z_probe(); - - SERIAL_PROTOCOLPGM("Bed x: "); - SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION); - SERIAL_PROTOCOLPGM(" y: "); - SERIAL_PROTOCOL(BACK_PROBE_BED_POSITION); - SERIAL_PROTOCOLPGM(" z: "); - SERIAL_PROTOCOL(current_position[Z_AXIS]); - SERIAL_PROTOCOLPGM("\n"); + float z_at_xLeft_yBack = probe_pt(LEFT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION, Z_RAISE_BEFORE_PROBING); // prob 2 - do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS); - 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]); - - engage_z_probe(); // Engage Z Servo endstop if available - run_z_probe(); - float z_at_xLeft_yFront = current_position[Z_AXIS]; - retract_z_probe(); - - SERIAL_PROTOCOLPGM("Bed x: "); - SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION); - SERIAL_PROTOCOLPGM(" y: "); - SERIAL_PROTOCOL(FRONT_PROBE_BED_POSITION); - SERIAL_PROTOCOLPGM(" z: "); - SERIAL_PROTOCOL(current_position[Z_AXIS]); - SERIAL_PROTOCOLPGM("\n"); + float z_at_xLeft_yFront = probe_pt(LEFT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS); // prob 3 - do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS); - // the current position will be updated by the blocking move so the head will not lower on this next call. - 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]); - - engage_z_probe(); // Engage Z Servo endstop if available - run_z_probe(); - float z_at_xRight_yFront = current_position[Z_AXIS]; - retract_z_probe(); // Retract Z Servo endstop if available - - SERIAL_PROTOCOLPGM("Bed x: "); - SERIAL_PROTOCOL(RIGHT_PROBE_BED_POSITION); - SERIAL_PROTOCOLPGM(" y: "); - SERIAL_PROTOCOL(FRONT_PROBE_BED_POSITION); - SERIAL_PROTOCOLPGM(" z: "); - SERIAL_PROTOCOL(current_position[Z_AXIS]); - SERIAL_PROTOCOLPGM("\n"); + float z_at_xRight_yFront = probe_pt(RIGHT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS); clean_up_after_endstop_move();