[2.0.x] Make MIN_PROBE_EDGE a general option (for electronic probes) (#10069)
Some probes don't work near the edges of the bed. This change promotes MIN_PROBE_EDGE to a general setting that applies to all probing functions.
This commit is contained in:
@ -360,32 +360,9 @@ void GcodeSuite::G29() {
|
||||
front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : FRONT_PROBE_BED_POSITION;
|
||||
back_probe_bed_position = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : BACK_PROBE_BED_POSITION;
|
||||
|
||||
const bool left_out_l = left_probe_bed_position < MIN_PROBE_X,
|
||||
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - (MIN_PROBE_EDGE),
|
||||
right_out_r = right_probe_bed_position > MAX_PROBE_X,
|
||||
right_out = right_out_r || right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE,
|
||||
front_out_f = front_probe_bed_position < MIN_PROBE_Y,
|
||||
front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - (MIN_PROBE_EDGE),
|
||||
back_out_b = back_probe_bed_position > MAX_PROBE_Y,
|
||||
back_out = back_out_b || back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE;
|
||||
|
||||
if (left_out || right_out || front_out || back_out) {
|
||||
if (left_out) {
|
||||
out_of_range_error(PSTR("(L)eft"));
|
||||
left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - (MIN_PROBE_EDGE);
|
||||
}
|
||||
if (right_out) {
|
||||
out_of_range_error(PSTR("(R)ight"));
|
||||
right_probe_bed_position = right_out_r ? MAX_PROBE_X : left_probe_bed_position + MIN_PROBE_EDGE;
|
||||
}
|
||||
if (front_out) {
|
||||
out_of_range_error(PSTR("(F)ront"));
|
||||
front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - (MIN_PROBE_EDGE);
|
||||
}
|
||||
if (back_out) {
|
||||
out_of_range_error(PSTR("(B)ack"));
|
||||
back_probe_bed_position = back_out_b ? MAX_PROBE_Y : front_probe_bed_position + MIN_PROBE_EDGE;
|
||||
}
|
||||
if ( !position_is_reachable_by_probe(left_probe_bed_position, front_probe_bed_position)
|
||||
|| !position_is_reachable_by_probe(right_probe_bed_position, back_probe_bed_position)) {
|
||||
SERIAL_PROTOCOLLNPGM("? (L,R,F,B) out of bounds.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -78,21 +78,10 @@ void GcodeSuite::M48() {
|
||||
const float X_probe_location = parser.linearval('X', X_current + X_PROBE_OFFSET_FROM_EXTRUDER),
|
||||
Y_probe_location = parser.linearval('Y', Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER);
|
||||
|
||||
#if DISABLED(DELTA)
|
||||
if (!WITHIN(X_probe_location, MIN_PROBE_X, MAX_PROBE_X)) {
|
||||
out_of_range_error(PSTR("X"));
|
||||
return;
|
||||
}
|
||||
if (!WITHIN(Y_probe_location, MIN_PROBE_Y, MAX_PROBE_Y)) {
|
||||
out_of_range_error(PSTR("Y"));
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!position_is_reachable_by_probe(X_probe_location, Y_probe_location)) {
|
||||
SERIAL_PROTOCOLLNPGM("? (X,Y) location outside of probeable radius.");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (!position_is_reachable_by_probe(X_probe_location, Y_probe_location)) {
|
||||
SERIAL_PROTOCOLLNPGM("? (X,Y) out of bounds.");
|
||||
return;
|
||||
}
|
||||
|
||||
bool seen_L = parser.seen('L');
|
||||
uint8_t n_legs = seen_L ? parser.value_byte() : 0;
|
||||
@ -137,8 +126,8 @@ void GcodeSuite::M48() {
|
||||
float angle = random(0, 360);
|
||||
const float radius = random(
|
||||
#if ENABLED(DELTA)
|
||||
(int) (0.1250000000 * (DELTA_PROBEABLE_RADIUS)),
|
||||
(int) (0.3333333333 * (DELTA_PROBEABLE_RADIUS))
|
||||
(int) (0.1250000000 * (DELTA_PRINTABLE_RADIUS)),
|
||||
(int) (0.3333333333 * (DELTA_PRINTABLE_RADIUS))
|
||||
#else
|
||||
(int) 5.0, (int) (0.125 * min(X_BED_SIZE, Y_BED_SIZE))
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user