Add M851 X Y probe offsets (#15202)

This commit is contained in:
InsanityAutomation
2019-09-24 22:29:21 -04:00
committed by Scott Lahteine
parent ebc9a8a0b0
commit df1e51258a
151 changed files with 1009 additions and 1878 deletions

View File

@ -1348,12 +1348,7 @@
#endif
#endif
#else
#undef X_PROBE_OFFSET_FROM_EXTRUDER
#undef Y_PROBE_OFFSET_FROM_EXTRUDER
#undef Z_PROBE_OFFSET_FROM_EXTRUDER
#define X_PROBE_OFFSET_FROM_EXTRUDER 0
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0
#undef NOZZLE_TO_PROBE_OFFSET
#endif
/**
@ -1446,10 +1441,13 @@
* Bed Probing rectangular bounds
* These can be further constrained in code for Delta and SCARA
*/
#ifndef MIN_PROBE_EDGE
#define MIN_PROBE_EDGE 0
#endif
#ifndef NOZZLE_TO_PROBE_OFFSET
#define NOZZLE_TO_PROBE_OFFSET { 0, 0, 0 }
#endif
constexpr float nozzle_to_probe_offset[XYZ] = NOZZLE_TO_PROBE_OFFSET;
#if ENABLED(DELTA)
/**
@ -1457,8 +1455,8 @@
*/
#define _PROBE_RADIUS (DELTA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE))
#ifndef DELTA_CALIBRATION_RADIUS
#ifdef X_PROBE_OFFSET_FROM_EXTRUDER
#define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - _MAX(ABS(X_PROBE_OFFSET_FROM_EXTRUDER), ABS(Y_PROBE_OFFSET_FROM_EXTRUDER), ABS(MIN_PROBE_EDGE)))
#ifdef NOZZLE_TO_PROBE_OFFSET
#define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - _MAX(ABS(nozzle_to_probe_offset[X_AXIS]), ABS(nozzle_to_probe_offset[Y_AXIS]), ABS(MIN_PROBE_EDGE)))
#else
#define DELTA_CALIBRATION_RADIUS _PROBE_RADIUS
#endif
@ -1467,39 +1465,39 @@
#define DELTA_ENDSTOP_ADJ { 0, 0, 0 }
#endif
#ifndef DELTA_TOWER_ANGLE_TRIM
#define DELTA_TOWER_ANGLE_TRIM {0, 0, 0}
#define DELTA_TOWER_ANGLE_TRIM { 0, 0, 0 }
#endif
#ifndef DELTA_RADIUS_TRIM_TOWER
#define DELTA_RADIUS_TRIM_TOWER {0, 0, 0}
#define DELTA_RADIUS_TRIM_TOWER { 0, 0, 0 }
#endif
#ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER
#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0}
#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0, 0, 0 }
#endif
// Probing points may be verified at compile time within the radius
// using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!")
// so that may be added to SanityCheck.h in the future.
#define _MIN_PROBE_X (X_CENTER - (_PROBE_RADIUS))
#define _MIN_PROBE_Y (Y_CENTER - (_PROBE_RADIUS))
#define _MAX_PROBE_X (X_CENTER + _PROBE_RADIUS)
#define _MAX_PROBE_Y (Y_CENTER + _PROBE_RADIUS)
#define PROBE_X_MIN (X_CENTER - (_PROBE_RADIUS))
#define PROBE_Y_MIN (Y_CENTER - (_PROBE_RADIUS))
#define PROBE_X_MAX (X_CENTER + _PROBE_RADIUS)
#define PROBE_Y_MAX (Y_CENTER + _PROBE_RADIUS)
#elif IS_SCARA
#define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2)
#define _PROBE_RADIUS (SCARA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE))
#define _MIN_PROBE_X (X_CENTER - (SCARA_PRINTABLE_RADIUS) + MIN_PROBE_EDGE)
#define _MIN_PROBE_Y (Y_CENTER - (SCARA_PRINTABLE_RADIUS) + MIN_PROBE_EDGE)
#define _MAX_PROBE_X (X_CENTER + SCARA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE))
#define _MAX_PROBE_Y (Y_CENTER + SCARA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE))
#define PROBE_X_MIN (X_CENTER - (SCARA_PRINTABLE_RADIUS) + MIN_PROBE_EDGE)
#define PROBE_Y_MIN (Y_CENTER - (SCARA_PRINTABLE_RADIUS) + MIN_PROBE_EDGE)
#define PROBE_X_MAX (X_CENTER + SCARA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE))
#define PROBE_Y_MAX (Y_CENTER + SCARA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE))
#else
// Boundaries for Cartesian probing based on bed limits
#define _MIN_PROBE_X (_MAX(X_MIN_BED + MIN_PROBE_EDGE, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define _MIN_PROBE_Y (_MAX(Y_MIN_BED + MIN_PROBE_EDGE, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define _MAX_PROBE_X (_MIN(X_MAX_BED - (MIN_PROBE_EDGE), X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define _MAX_PROBE_Y (_MIN(Y_MAX_BED - (MIN_PROBE_EDGE), Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define PROBE_X_MIN (_MAX(X_MIN_BED + MIN_PROBE_EDGE, X_MIN_POS + nozzle_to_probe_offset[X_AXIS]))
#define PROBE_Y_MIN (_MAX(Y_MIN_BED + MIN_PROBE_EDGE, Y_MIN_POS + nozzle_to_probe_offset[Y_AXIS]))
#define PROBE_X_MAX (_MIN(X_MAX_BED - (MIN_PROBE_EDGE), X_MAX_POS + nozzle_to_probe_offset[X_AXIS]))
#define PROBE_Y_MAX (_MIN(Y_MAX_BED - (MIN_PROBE_EDGE), Y_MAX_POS + nozzle_to_probe_offset[Y_AXIS]))
#endif
@ -1507,20 +1505,6 @@
#define LEVELED_SEGMENT_LENGTH 5
#endif
// These may be overridden in Configuration.h if a smaller area is desired
#ifndef MIN_PROBE_X
#define MIN_PROBE_X _MIN_PROBE_X
#endif
#ifndef MIN_PROBE_Y
#define MIN_PROBE_Y _MIN_PROBE_Y
#endif
#ifndef MAX_PROBE_X
#define MAX_PROBE_X _MAX_PROBE_X
#endif
#ifndef MAX_PROBE_Y
#define MAX_PROBE_Y _MAX_PROBE_Y
#endif
/**
* Default mesh area is an area with an inset margin on the print area.
*/
@ -1537,14 +1521,14 @@
// Boundaries for Cartesian probing based on set limits
#if ENABLED(AUTO_BED_LEVELING_UBL)
#define _MESH_MIN_X (_MAX(X_MIN_BED + MESH_INSET, X_MIN_POS)) // UBL is careful not to probe off the bed. It does not
#define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS)) // need *_PROBE_OFFSET_FROM_EXTRUDER in the mesh dimensions
#define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS)) // need NOZZLE_TO_PROBE_OFFSET in the mesh dimensions
#define _MESH_MAX_X (_MIN(X_MAX_BED - (MESH_INSET), X_MAX_POS))
#define _MESH_MAX_Y (_MIN(Y_MAX_BED - (MESH_INSET), Y_MAX_POS))
#else
#define _MESH_MIN_X (_MAX(X_MIN_BED + MESH_INSET, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define _MESH_MAX_X (_MIN(X_MAX_BED - (MESH_INSET), X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define _MESH_MAX_Y (_MIN(Y_MAX_BED - (MESH_INSET), Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define _MESH_MIN_X (_MAX(X_MIN_BED + MESH_INSET, X_MIN_POS + nozzle_to_probe_offset[X_AXIS]))
#define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS + nozzle_to_probe_offset[Y_AXIS]))
#define _MESH_MAX_X (_MIN(X_MAX_BED - (MESH_INSET), X_MAX_POS + nozzle_to_probe_offset[X_AXIS]))
#define _MESH_MAX_Y (_MIN(Y_MAX_BED - (MESH_INSET), Y_MAX_POS + nozzle_to_probe_offset[Y_AXIS]))
#endif
#endif
@ -1592,41 +1576,26 @@
#endif
#else
#ifndef PROBE_PT_1_X
#define PROBE_PT_1_X MIN_PROBE_X
#define PROBE_PT_1_X PROBE_X_MIN
#endif
#ifndef PROBE_PT_1_Y
#define PROBE_PT_1_Y MIN_PROBE_Y
#define PROBE_PT_1_Y PROBE_Y_MIN
#endif
#ifndef PROBE_PT_2_X
#define PROBE_PT_2_X MAX_PROBE_X
#define PROBE_PT_2_X PROBE_X_MAX
#endif
#ifndef PROBE_PT_2_Y
#define PROBE_PT_2_Y MIN_PROBE_Y
#define PROBE_PT_2_Y PROBE_Y_MIN
#endif
#ifndef PROBE_PT_3_X
#define PROBE_PT_3_X X_CENTER
#endif
#ifndef PROBE_PT_3_Y
#define PROBE_PT_3_Y MAX_PROBE_Y
#define PROBE_PT_3_Y PROBE_Y_MAX
#endif
#endif
#endif
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
#ifndef LEFT_PROBE_BED_POSITION
#define LEFT_PROBE_BED_POSITION MIN_PROBE_X
#endif
#ifndef RIGHT_PROBE_BED_POSITION
#define RIGHT_PROBE_BED_POSITION MAX_PROBE_X
#endif
#ifndef FRONT_PROBE_BED_POSITION
#define FRONT_PROBE_BED_POSITION MIN_PROBE_Y
#endif
#ifndef BACK_PROBE_BED_POSITION
#define BACK_PROBE_BED_POSITION MAX_PROBE_Y
#endif
#endif
/**
* Buzzer/Speaker
*/

View File

@ -390,6 +390,10 @@
#error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h."
#elif defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_X) || defined(Z_PROBE_ALLEN_KEY_STOW_1_X)
#error "Z_PROBE_ALLEN_KEY_(DEPLOY|STOW) coordinates are now a single setting. Please update your configuration."
#elif defined(X_PROBE_OFFSET_FROM_EXTRUDER) || defined(Y_PROBE_OFFSET_FROM_EXTRUDER) || defined(Z_PROBE_OFFSET_FROM_EXTRUDER)
#error "[XYZ]_PROBE_OFFSET_FROM_EXTRUDER is now NOZZLE_TO_PROBE_OFFSET. Please update your configuration."
#elif defined(MIN_PROBE_X) || defined(MIN_PROBE_Y) || defined(MAX_PROBE_X) || defined(MAX_PROBE_Y)
#error "(MIN|MAX)_PROBE_[XY] are now calculated at runtime. Please remove them from Configuration.h."
#endif
#define BOARD_MKS_13 -1000
@ -1051,9 +1055,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#if HAS_BED_PROBE
static_assert(FLOOR(float(X_PROBE_OFFSET_FROM_EXTRUDER)) == float(X_PROBE_OFFSET_FROM_EXTRUDER), "X_PROBE_OFFSET_FROM_EXTRUDER must be an integer!");
static_assert(FLOOR(float(Y_PROBE_OFFSET_FROM_EXTRUDER)) == float(Y_PROBE_OFFSET_FROM_EXTRUDER), "Y_PROBE_OFFSET_FROM_EXTRUDER must be an integer!");
/**
* Z_PROBE_SLED is incompatible with DELTA
*/
@ -1205,14 +1206,18 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
* Bed Leveling Requirements
*/
#if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
static_assert(WITHIN(PROBE_PT_1_X, MIN_PROBE_X, MAX_PROBE_X), "PROBE_PT_1_X is outside the probe region.");
static_assert(WITHIN(PROBE_PT_2_X, MIN_PROBE_X, MAX_PROBE_X), "PROBE_PT_2_X is outside the probe region.");
static_assert(WITHIN(PROBE_PT_3_X, MIN_PROBE_X, MAX_PROBE_X), "PROBE_PT_3_X is outside the probe region.");
static_assert(WITHIN(PROBE_PT_1_Y, MIN_PROBE_Y, MAX_PROBE_Y), "PROBE_PT_1_Y is outside the probe region.");
static_assert(WITHIN(PROBE_PT_2_Y, MIN_PROBE_Y, MAX_PROBE_Y), "PROBE_PT_2_Y is outside the probe region.");
static_assert(WITHIN(PROBE_PT_3_Y, MIN_PROBE_Y, MAX_PROBE_Y), "PROBE_PT_3_Y is outside the probe region.");
#endif
//
// !! TODO: REPLACE WITH TESTS IN THE 3-POINT LEVELING CODE !!
//
//#if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
// static_assert(WITHIN(PROBE_PT_1_X, PROBE_X_MIN, PROBE_X_MAX), "PROBE_PT_1_X is outside the probe region.");
// static_assert(WITHIN(PROBE_PT_2_X, PROBE_X_MIN, PROBE_X_MAX), "PROBE_PT_2_X is outside the probe region.");
// static_assert(WITHIN(PROBE_PT_3_X, PROBE_X_MIN, PROBE_X_MAX), "PROBE_PT_3_X is outside the probe region.");
// static_assert(WITHIN(PROBE_PT_1_Y, PROBE_Y_MIN, PROBE_Y_MAX), "PROBE_PT_1_Y is outside the probe region.");
// static_assert(WITHIN(PROBE_PT_2_Y, PROBE_Y_MIN, PROBE_Y_MAX), "PROBE_PT_2_Y is outside the probe region.");
// static_assert(WITHIN(PROBE_PT_3_Y, PROBE_Y_MIN, PROBE_Y_MAX), "PROBE_PT_3_Y is outside the probe region.");
//#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
@ -1246,20 +1251,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "SCARA machines can only use the AUTO_BED_LEVELING_BILINEAR leveling option."
#endif
/**
* Check auto bed leveling probe points
*/
#if ABL_GRID
static_assert(LEFT_PROBE_BED_POSITION < RIGHT_PROBE_BED_POSITION, "LEFT_PROBE_BED_POSITION must be less than RIGHT_PROBE_BED_POSITION.");
static_assert(FRONT_PROBE_BED_POSITION < BACK_PROBE_BED_POSITION, "FRONT_PROBE_BED_POSITION must be less than BACK_PROBE_BED_POSITION.");
static_assert(LEFT_PROBE_BED_POSITION >= MIN_PROBE_X, "LEFT_PROBE_BED_POSITION is outside the probe region.");
static_assert(RIGHT_PROBE_BED_POSITION <= MAX_PROBE_X, "RIGHT_PROBE_BED_POSITION is outside the probe region.");
static_assert(FRONT_PROBE_BED_POSITION >= MIN_PROBE_Y, "FRONT_PROBE_BED_POSITION is outside the probe region.");
static_assert(BACK_PROBE_BED_POSITION <= MAX_PROBE_Y, "BACK_PROBE_BED_POSITION is outside the probe region.");
#endif
#elif ENABLED(MESH_BED_LEVELING)
// Hide PROBE_MANUALLY from the rest of the code
@ -1328,8 +1319,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
*/
#if ENABLED(Z_SAFE_HOMING)
#if HAS_BED_PROBE
static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, MIN_PROBE_X, MAX_PROBE_X), "Z_SAFE_HOMING_X_POINT is outside the probe region.");
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, MIN_PROBE_Y, MAX_PROBE_Y), "Z_SAFE_HOMING_Y_POINT is outside the probe region.");
//
// !! TODO: REPLACE WITH TESTS IN THE Z_SAFE_HOMING CODE !!
//
//static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, PROBE_X_MIN, PROBE_X_MAX), "Z_SAFE_HOMING_X_POINT is outside the probe region.");
//static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, PROBE_Y_MIN, PROBE_Y_MAX), "Z_SAFE_HOMING_Y_POINT is outside the probe region.");
#else
static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, X_MIN_POS, X_MAX_POS), "Z_SAFE_HOMING_X_POINT can't be reached by the nozzle.");
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, Y_MIN_POS, Y_MAX_POS), "Z_SAFE_HOMING_Y_POINT can't be reached by the nozzle.");