Browse Source

Account for coordinate space more in G28 / G29 / M48

pull/1/head
Scott Lahteine 8 years ago
parent
commit
2595a40a61
  1. 32
      Marlin/Marlin_main.cpp

32
Marlin/Marlin_main.cpp

@ -3075,7 +3075,7 @@ inline void gcode_G28() {
* NOTE: This doesn't necessarily ensure the Z probe is also * NOTE: This doesn't necessarily ensure the Z probe is also
* within the bed! * within the bed!
*/ */
float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS]; float cpx = RAW_CURRENT_POSITION(X_AXIS), cpy = RAW_CURRENT_POSITION(Y_AXIS);
if ( cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER) if ( cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
&& cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER) && cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
&& cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER) && cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)
@ -3472,36 +3472,36 @@ inline void gcode_G28() {
xy_probe_feedrate_mm_m = code_seen('S') ? (int)code_value_linear_units() : XY_PROBE_SPEED; xy_probe_feedrate_mm_m = code_seen('S') ? (int)code_value_linear_units() : XY_PROBE_SPEED;
int left_probe_bed_position = code_seen('L') ? (int)code_value_axis_units(X_AXIS) : LEFT_PROBE_BED_POSITION, int left_probe_bed_position = code_seen('L') ? (int)code_value_axis_units(X_AXIS) : LOGICAL_X_POSITION(LEFT_PROBE_BED_POSITION),
right_probe_bed_position = code_seen('R') ? (int)code_value_axis_units(X_AXIS) : RIGHT_PROBE_BED_POSITION, right_probe_bed_position = code_seen('R') ? (int)code_value_axis_units(X_AXIS) : LOGICAL_X_POSITION(RIGHT_PROBE_BED_POSITION),
front_probe_bed_position = code_seen('F') ? (int)code_value_axis_units(Y_AXIS) : FRONT_PROBE_BED_POSITION, front_probe_bed_position = code_seen('F') ? (int)code_value_axis_units(Y_AXIS) : LOGICAL_Y_POSITION(FRONT_PROBE_BED_POSITION),
back_probe_bed_position = code_seen('B') ? (int)code_value_axis_units(Y_AXIS) : BACK_PROBE_BED_POSITION; back_probe_bed_position = code_seen('B') ? (int)code_value_axis_units(Y_AXIS) : LOGICAL_Y_POSITION(BACK_PROBE_BED_POSITION);
bool left_out_l = left_probe_bed_position < MIN_PROBE_X, bool left_out_l = left_probe_bed_position < LOGICAL_X_POSITION(MIN_PROBE_X),
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - (MIN_PROBE_EDGE), 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_r = right_probe_bed_position > LOGICAL_X_POSITION(MAX_PROBE_X),
right_out = right_out_r || right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE, 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_f = front_probe_bed_position < LOGICAL_Y_POSITION(MIN_PROBE_Y),
front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - (MIN_PROBE_EDGE), 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_b = back_probe_bed_position > LOGICAL_Y_POSITION(MAX_PROBE_Y),
back_out = back_out_b || back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE; 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 || right_out || front_out || back_out) {
if (left_out) { if (left_out) {
out_of_range_error(PSTR("(L)eft")); out_of_range_error(PSTR("(L)eft"));
left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - (MIN_PROBE_EDGE); left_probe_bed_position = left_out_l ? LOGICAL_X_POSITION(MIN_PROBE_X) : right_probe_bed_position - (MIN_PROBE_EDGE);
} }
if (right_out) { if (right_out) {
out_of_range_error(PSTR("(R)ight")); out_of_range_error(PSTR("(R)ight"));
right_probe_bed_position = right_out_r ? MAX_PROBE_X : left_probe_bed_position + MIN_PROBE_EDGE; right_probe_bed_position = right_out_r ? LOGICAL_Y_POSITION(MAX_PROBE_X) : left_probe_bed_position + MIN_PROBE_EDGE;
} }
if (front_out) { if (front_out) {
out_of_range_error(PSTR("(F)ront")); out_of_range_error(PSTR("(F)ront"));
front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - (MIN_PROBE_EDGE); front_probe_bed_position = front_out_f ? LOGICAL_Y_POSITION(MIN_PROBE_Y) : back_probe_bed_position - (MIN_PROBE_EDGE);
} }
if (back_out) { if (back_out) {
out_of_range_error(PSTR("(B)ack")); out_of_range_error(PSTR("(B)ack"));
back_probe_bed_position = back_out_b ? MAX_PROBE_Y : front_probe_bed_position + MIN_PROBE_EDGE; back_probe_bed_position = back_out_b ? LOGICAL_Y_POSITION(MAX_PROBE_Y) : front_probe_bed_position + MIN_PROBE_EDGE;
} }
return; return;
} }
@ -4208,7 +4208,7 @@ inline void gcode_M42() {
float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER; float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
#if DISABLED(DELTA) #if DISABLED(DELTA)
if (X_probe_location < MIN_PROBE_X || X_probe_location > MAX_PROBE_X) { if (X_probe_location < LOGICAL_X_POSITION(MIN_PROBE_X) || X_probe_location > LOGICAL_X_POSITION(MAX_PROBE_X)) {
out_of_range_error(PSTR("X")); out_of_range_error(PSTR("X"));
return; return;
} }
@ -4216,12 +4216,12 @@ inline void gcode_M42() {
float Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER; float Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER;
#if DISABLED(DELTA) #if DISABLED(DELTA)
if (Y_probe_location < MIN_PROBE_Y || Y_probe_location > MAX_PROBE_Y) { if (Y_probe_location < LOGICAL_Y_POSITION(MIN_PROBE_Y) || Y_probe_location > LOGICAL_Y_POSITION(MAX_PROBE_Y)) {
out_of_range_error(PSTR("Y")); out_of_range_error(PSTR("Y"));
return; return;
} }
#else #else
if (HYPOT(X_probe_location, Y_probe_location) > DELTA_PROBEABLE_RADIUS) { if (HYPOT(RAW_X_POSITION(X_probe_location), RAW_Y_POSITION(Y_probe_location)) > DELTA_PROBEABLE_RADIUS) {
SERIAL_PROTOCOLLNPGM("? (X,Y) location outside of probeable radius."); SERIAL_PROTOCOLLNPGM("? (X,Y) location outside of probeable radius.");
return; return;
} }

Loading…
Cancel
Save