diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index cea5de6cb9..1b498ca0dc 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1296,32 +1296,73 @@ static void setup_for_endstop_move() { } #elif defined(Z_PROBE_ALLEN_KEY) + feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE; - feedrate = homing_feedrate[X_AXIS]; + // If endstop is already false, the probe is deployed + #ifdef Z_PROBE_ENDSTOP + bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING); + if (z_probe_endstop) + #else + bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); + if (z_min_endstop) + #endif + { - // Move to the start position to initiate deployment - destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_X; - destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Y; - destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Z; - prepare_move_raw(); // this will also set_current_to_destination + // Move to the start position to initiate deployment + destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_X; + destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Y; + destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Z; + prepare_move_raw(); // this will also set_current_to_destination - // Home X to touch the belt - feedrate = homing_feedrate[X_AXIS]/10; - destination[X_AXIS] = 0; - prepare_move_raw(); // this will also set_current_to_destination - - // Home Y for safety - feedrate = homing_feedrate[X_AXIS]/2; - destination[Y_AXIS] = 0; + // Move to engage deployment + if (Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE) { + feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE; + } + if (Z_PROBE_ALLEN_KEY_DEPLOY_2_X != Z_PROBE_ALLEN_KEY_DEPLOY_1_X) { + destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_X; + } + if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Y != Z_PROBE_ALLEN_KEY_DEPLOY_1_Y) { + destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Y; + } + if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Z != Z_PROBE_ALLEN_KEY_DEPLOY_1_Z) { + destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Z; + } + prepare_move_raw(); + + #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_3_X + if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE) { + feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE; + } + + // Move to trigger deployment + if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE) { + feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE; + } + if (Z_PROBE_ALLEN_KEY_DEPLOY_3_X != Z_PROBE_ALLEN_KEY_DEPLOY_2_X) { + destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_X; + } + if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Y != Z_PROBE_ALLEN_KEY_DEPLOY_2_Y) { + destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Y; + } + if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Z != Z_PROBE_ALLEN_KEY_DEPLOY_2_Z) { + destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Z; + } + prepare_move_raw(); + #endif + } + + // Partially Home X,Y for safety + destination[X_AXIS] = destination[X_AXIS]*0.75; + destination[Y_AXIS] = destination[Y_AXIS]*0.75; prepare_move_raw(); // this will also set_current_to_destination - + st_synchronize(); #ifdef Z_PROBE_ENDSTOP - bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING); + z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING); if (z_probe_endstop) #else - bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); + z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); if (z_min_endstop) #endif { @@ -1366,25 +1407,41 @@ static void setup_for_endstop_move() { #elif defined(Z_PROBE_ALLEN_KEY) // Move up for safety - feedrate = homing_feedrate[X_AXIS]; + feedrate = Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE; destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING; prepare_move_raw(); // this will also set_current_to_destination // Move to the start position to initiate retraction - destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_X; - destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_Y; - destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_Z; - prepare_move_raw(); // this will also set_current_to_destination + destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_X; + destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Y; + destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Z; + prepare_move_raw(); // Move the nozzle down to push the probe into retracted position - feedrate = homing_feedrate[Z_AXIS]/10; - destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_STOW_DEPTH; - prepare_move_raw(); // this will also set_current_to_destination + if (Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE) { + feedrate = Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE; + } + if (Z_PROBE_ALLEN_KEY_STOW_2_X != Z_PROBE_ALLEN_KEY_STOW_1_X) { + destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_X; + } + if (Z_PROBE_ALLEN_KEY_STOW_2_Y != Z_PROBE_ALLEN_KEY_STOW_1_Y) { + destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Y; + } + destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Z; + prepare_move_raw(); // Move up for safety - feedrate = homing_feedrate[Z_AXIS]/2; - destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_STOW_DEPTH * 2; - prepare_move_raw(); // this will also set_current_to_destination + if (Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE) { + feedrate = Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE; + } + if (Z_PROBE_ALLEN_KEY_STOW_3_X != Z_PROBE_ALLEN_KEY_STOW_2_X) { + destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_X; + } + if (Z_PROBE_ALLEN_KEY_STOW_3_Y != Z_PROBE_ALLEN_KEY_STOW_2_Y) { + destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Y; + } + destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Z; + prepare_move_raw(); // Home XY for safety feedrate = homing_feedrate[X_AXIS]/2; diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 1c5ce8c02f..8b59e169ca 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -401,8 +401,8 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic const bool FIL_RUNOUT_INVERTING = true; // Should be uncommented and true or false should assigned #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined. #define FILAMENT_RUNOUT_SCRIPT "M600" -#endif - +#endif + //=========================================================================== //=========================== Manual Bed Leveling =========================== //=========================================================================== @@ -454,10 +454,10 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define LEFT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS #define RIGHT_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS - #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS + #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS #define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS - #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this // Non-linear bed leveling will be used. // Compensate by interpolating between the nearest four Z probe values for each point. @@ -495,7 +495,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. //Useful to retract a deployable probe. - + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. @@ -507,16 +507,36 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. #define Z_PROBE_ALLEN_KEY #ifdef Z_PROBE_ALLEN_KEY - #define Z_PROBE_ALLEN_KEY_DEPLOY_X 30 - #define Z_PROBE_ALLEN_KEY_DEPLOY_Y DELTA_PRINTABLE_RADIUS - #define Z_PROBE_ALLEN_KEY_DEPLOY_Z 100 - - #define Z_PROBE_ALLEN_KEY_STOW_X -64 - #define Z_PROBE_ALLEN_KEY_STOW_Y 56 - #define Z_PROBE_ALLEN_KEY_STOW_Z 23 + + // Kossel Mini + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_X 30.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_Y DELTA_PRINTABLE_RADIUS + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_Z 100.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE XY_TRAVEL_SPEED + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_X 0.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Y DELTA_PRINTABLE_RADIUS + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_TRAVEL_SPEED/10) + #define Z_PROBE_ALLEN_KEY_STOW_DEPTH 20 + // Move the probe into position + #define Z_PROBE_ALLEN_KEY_STOW_1_X -64.0 + #define Z_PROBE_ALLEN_KEY_STOW_1_Y 56.0 + #define Z_PROBE_ALLEN_KEY_STOW_1_Z 23.0 + #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE XY_TRAVEL_SPEED + // Move the nozzle down further to push the probe into retracted position. + #define Z_PROBE_ALLEN_KEY_STOW_2_X Z_PROBE_ALLEN_KEY_STOW_1_X + #define Z_PROBE_ALLEN_KEY_STOW_2_Y Z_PROBE_ALLEN_KEY_STOW_1_Y + #define Z_PROBE_ALLEN_KEY_STOW_2_Z (Z_PROBE_ALLEN_KEY_STOW_1_Z-Z_PROBE_ALLEN_KEY_STOW_DEPTH) + #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE (XY_TRAVEL_SPEED/10) + // Raise things back up slightly so we don't bump into anything + #define Z_PROBE_ALLEN_KEY_STOW_3_X Z_PROBE_ALLEN_KEY_STOW_2_X + #define Z_PROBE_ALLEN_KEY_STOW_3_Y Z_PROBE_ALLEN_KEY_STOW_2_Y + #define Z_PROBE_ALLEN_KEY_STOW_3_Z (Z_PROBE_ALLEN_KEY_STOW_1_Z+Z_PROBE_ALLEN_KEY_STOW_DEPTH) + #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE (XY_TRAVEL_SPEED/2) + #endif - + //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it. // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.