From 97d6db15cf37f55b0b66e3009893620e88f73d5c Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Tue, 14 Jul 2020 20:09:41 +0200 Subject: [PATCH] Add BLTouch Support (can be enabled with #define KNUTWURST_BLTOUCH) --- Marlin/Configuration.h | 48 +++++++++++++++++++++++++++++++++----- Marlin/Configuration_adv.h | 17 +++++++++++++- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 2f495abb..4e24a168 100755 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -40,6 +40,8 @@ #define KNUTWURST_MEGAS #define KNUTWURST_TMC +//#define KNUTWURST_BLTOUCH +//#define KNUTWURST_DEBUG //#define POWER_OUTAGE_TEST //=========================================================================== @@ -909,7 +911,9 @@ * - normally-open switches to 5V and D32. * */ -//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default +#if ENABLED(KNUTWURST_BLTOUCH) +#define Z_MIN_PROBE_PIN 2 // Pin 32 is the RAMPS default +#endif /** * Probe Type @@ -923,7 +927,10 @@ * Use G29 repeatedly, adjusting the Z height at each point with movement commands * or (with LCD_BED_LEVELING) the LCD controller. */ +#if DISABLED(KNUTWURST_BLTOUCH) #define PROBE_MANUALLY +#endif + //#define MANUAL_PROBE_START_Z 0.2 /** @@ -947,7 +954,9 @@ /** * The BLTouch probe uses a Hall effect sensor and emulates a servo. */ -//#define BLTOUCH +#if ENABLED(KNUTWURST_BLTOUCH) +#define BLTOUCH +#endif /** * Touch-MI Probe by hotends.fr @@ -1019,14 +1028,20 @@ * * Specify a Probe position as { X, Y, Z } */ +#if ENABLED(KNUTWURST_BLTOUCH) +#define NOZZLE_TO_PROBE_OFFSET { 29, -15, 0 } +#endif + +#if DISABLED(KNUTWURST_BLTOUCH) #define NOZZLE_TO_PROBE_OFFSET { 10, 10, 0 } +#endif // Most probes should stay away from the edges of the bed, but // with NOZZLE_AS_PROBE this can be negative for a wider probing area. #define MIN_PROBE_EDGE 10 // X and Y axis travel speed (mm/m) between probes -#define XY_PROBE_SPEED 8000 +#define XY_PROBE_SPEED 3600 // Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) #define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z @@ -1065,14 +1080,23 @@ #define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes //#define Z_AFTER_PROBING 5 // Z position after probing is done +#if ENABLED(KNUTWURST_BLTOUCH) +#define Z_PROBE_LOW_POINT -5 // Farthest distance below the trigger-point to go before stopping +#endif + +#if DISABLED(KNUTWURST_BLTOUCH) #define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping +#endif + // For M851 give a range for adjusting the Z probe offset #define Z_PROBE_OFFSET_RANGE_MIN -20 #define Z_PROBE_OFFSET_RANGE_MAX 20 // Enable the M48 repeatability test to test probe accuracy -//#define Z_MIN_PROBE_REPEATABILITY_TEST +#if ENABLED(KNUTWURST_BLTOUCH) +#define Z_MIN_PROBE_REPEATABILITY_TEST +#endif // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW @@ -1286,11 +1310,21 @@ * leveling in steps so you can manually adjust the Z height at each grid-point. * With an LCD controller the process is guided step-by-step. */ +#if ENABLED(KNUTWURST_BLTOUCH) +//#define AUTO_BED_LEVELING_3POINT +//#define AUTO_BED_LEVELING_LINEAR +#define AUTO_BED_LEVELING_BILINEAR +//#define AUTO_BED_LEVELING_UBL +//#define MESH_BED_LEVELING +#endif + +#if DISABLED(KNUTWURST_BLTOUCH) //#define AUTO_BED_LEVELING_3POINT //#define AUTO_BED_LEVELING_LINEAR //#define AUTO_BED_LEVELING_BILINEAR //#define AUTO_BED_LEVELING_UBL #define MESH_BED_LEVELING +#endif /** * Normally G28 leaves leveling disabled on completion. Enable @@ -1303,7 +1337,9 @@ * Turn on with the command 'M111 S32'. * NOTE: Requires a lot of PROGMEM! */ -//#define DEBUG_LEVELING_FEATURE +#if ENABLED(KNUTWURST_DEBUG) +#define DEBUG_LEVELING_FEATURE +#endif #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL) // Gradually reduce leveling correction until a set height is reached, @@ -1335,7 +1371,7 @@ #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. - #define GRID_MAX_POINTS_X 3 + #define GRID_MAX_POINTS_X 5 #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X // Probe along the Y axis, advancing X after each column diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index fbc16b41..eea23792 100755 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -35,6 +35,8 @@ #define KNUTWURST_MEGAS_ADV #define KNUTWURST_TMC_ADV +//#define KNUTWURST_BLTOUCH +//#define KNUTWURST_DEBUG // @section temperature @@ -1471,7 +1473,9 @@ * * Warning: Does not respect endstops! */ -//#define BABYSTEPPING +#if ENABLED(KNUTWURST_BLTOUCH) +#define BABYSTEPPING +#endif #if ENABLED(BABYSTEPPING) //#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR //#define BABYSTEP_WITHOUT_HOMING @@ -1556,12 +1560,23 @@ * probe points will follow. This prevents any change from causing * the probe to be unable to reach any points. */ +#if ENABLED(KNUTWURST_BLTOUCH) +#if PROBE_SELECTED && !IS_KINEMATIC + #define MIN_PROBE_EDGE_LEFT 10 + #define MIN_PROBE_EDGE_RIGHT 10 + #define MIN_PROBE_EDGE_FRONT 10 + #define MIN_PROBE_EDGE_BACK 10 +#endif +#endif + +#if DISABLED(KNUTWURST_BLTOUCH) #if PROBE_SELECTED && !IS_KINEMATIC //#define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE //#define MIN_PROBE_EDGE_RIGHT MIN_PROBE_EDGE //#define MIN_PROBE_EDGE_FRONT MIN_PROBE_EDGE //#define MIN_PROBE_EDGE_BACK MIN_PROBE_EDGE #endif +#endif #if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) // Override the mesh area if the automatic (max) area is too large