Patch probe offset name, defines

This commit is contained in:
Scott Lahteine 2019-09-24 23:34:07 -05:00
parent 4e8d9fe59b
commit 5288c399ce
4 changed files with 55 additions and 51 deletions

View file

@ -391,18 +391,21 @@ G29_TYPE GcodeSuite::G29() {
xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_SPEED)); xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_SPEED));
const float x_min = probe_min_x(), x_max = probe_max_x(),
y_min = probe_min_y(), y_max = probe_max_y();
if (parser.seen('H')) { if (parser.seen('H')) {
const int16_t size = (int16_t)parser.value_linear_units(); const int16_t size = (int16_t)parser.value_linear_units();
left_probe_bed_position = _MAX(X_CENTER - size / 2, probe_min_x()); left_probe_bed_position = _MAX(X_CENTER - size / 2, x_min);
right_probe_bed_position = _MIN(left_probe_bed_position + size, probe_max_x()); right_probe_bed_position = _MIN(left_probe_bed_position + size, x_max);
front_probe_bed_position = _MAX(Y_CENTER - size / 2, probe_min_y()); front_probe_bed_position = _MAX(Y_CENTER - size / 2, y_min);
back_probe_bed_position = _MIN(front_probe_bed_position + size, probe_max_y()); back_probe_bed_position = _MIN(front_probe_bed_position + size, y_max);
} }
else { else {
left_probe_bed_position = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MAX(X_CENTER - X_BED_SIZE / 2, probe_min_x()); left_probe_bed_position = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MAX(X_CENTER - X_BED_SIZE / 2, x_min);
right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MIN(left_probe_bed_position + X_BED_SIZE, probe_max_x()); right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MIN(left_probe_bed_position + X_BED_SIZE, x_max);
front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MAX(Y_CENTER - Y_BED_SIZE / 2, probe_min_y()); front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MAX(Y_CENTER - Y_BED_SIZE / 2, y_min);
back_probe_bed_position = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MIN(front_probe_bed_position + Y_BED_SIZE, probe_max_y()); back_probe_bed_position = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MIN(front_probe_bed_position + Y_BED_SIZE, y_max);
} }
if ( if (

View file

@ -39,9 +39,7 @@
#include "../../feature/tmc_util.h" #include "../../feature/tmc_util.h"
#endif #endif
#if HOMING_Z_WITH_PROBE || ENABLED(BLTOUCH) #include "../../module/probe.h"
#include "../../module/probe.h"
#endif
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
#include "../../feature/bltouch.h" #include "../../feature/bltouch.h"

View file

@ -28,9 +28,9 @@
#if HAS_BED_PROBE #if HAS_BED_PROBE
#include "../libs/buzzer.h"
#include "probe.h" #include "probe.h"
#include "../libs/buzzer.h"
#include "motion.h" #include "motion.h"
#include "temperature.h" #include "temperature.h"
#include "endstops.h" #include "endstops.h"
@ -86,43 +86,6 @@ float probe_offset[XYZ]; // Initialized by settings.load()
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../core/debug_out.h" #include "../core/debug_out.h"
float probe_min_x() {
return _MAX(
#if ENABLED(DELTA) || IS_SCARA
PROBE_X_MIN, MESH_MIN_X
#else
(X_MIN_BED) + (MIN_PROBE_EDGE), (X_MIN_POS) + probe_offset[X_AXIS]
#endif
);
}
float probe_max_x() {
return _MIN(
#if ENABLED(DELTA) || IS_SCARA
PROBE_X_MAX, MESH_MAX_X
#else
(X_MAX_BED) - (MIN_PROBE_EDGE), (X_MAX_POS) + probe_offset[X_AXIS]
#endif
);
}
float probe_min_y() {
return _MAX(
#if ENABLED(DELTA) || IS_SCARA
PROBE_Y_MIN, MESH_MIN_Y
#else
(Y_MIN_BED) + (MIN_PROBE_EDGE), (Y_MIN_POS) + probe_offset[Y_AXIS]
#endif
);
}
float probe_max_y() {
return _MIN(
#if ENABLED(DELTA) || IS_SCARA
PROBE_Y_MAX, MESH_MAX_Y
#else
(Y_MAX_BED) - (MIN_PROBE_EDGE), (Y_MAX_POS) + probe_offset[Y_AXIS]
#endif
);
}
#if ENABLED(Z_PROBE_SLED) #if ENABLED(Z_PROBE_SLED)
#ifndef SLED_DOCKING_OFFSET #ifndef SLED_DOCKING_OFFSET

View file

@ -47,7 +47,42 @@
extern const char msg_wait_for_bed_heating[25]; extern const char msg_wait_for_bed_heating[25];
#endif #endif
float probe_min_x(), probe_max_x(), probe_min_y(), probe_max_y(); inline float probe_min_x() {
return _MAX(
#if ENABLED(DELTA) || IS_SCARA
PROBE_X_MIN, MESH_MIN_X
#else
(X_MIN_BED) + (MIN_PROBE_EDGE), (X_MIN_POS) + probe_offset[X_AXIS]
#endif
);
}
inline float probe_max_x() {
return _MIN(
#if ENABLED(DELTA) || IS_SCARA
PROBE_X_MAX, MESH_MAX_X
#else
(X_MAX_BED) - (MIN_PROBE_EDGE), (X_MAX_POS) + probe_offset[X_AXIS]
#endif
);
}
inline float probe_min_y() {
return _MAX(
#if ENABLED(DELTA) || IS_SCARA
PROBE_Y_MIN, MESH_MIN_Y
#else
(Y_MIN_BED) + (MIN_PROBE_EDGE), (Y_MIN_POS) + probe_offset[Y_AXIS]
#endif
);
}
inline float probe_max_y() {
return _MIN(
#if ENABLED(DELTA) || IS_SCARA
PROBE_Y_MAX, MESH_MAX_Y
#else
(Y_MAX_BED) - (MIN_PROBE_EDGE), (Y_MAX_POS) + probe_offset[Y_AXIS]
#endif
);
}
#else #else
@ -55,6 +90,11 @@
#define DEPLOY_PROBE() #define DEPLOY_PROBE()
#define STOW_PROBE() #define STOW_PROBE()
inline float probe_min_x() { return 0; };
inline float probe_max_x() { return 0; };
inline float probe_min_y() { return 0; };
inline float probe_max_y() { return 0; };
#endif #endif
#if HAS_Z_SERVO_PROBE #if HAS_Z_SERVO_PROBE