Move G7 to G42

See: #6777
This commit is contained in:
Brian 2017-05-21 16:47:09 -04:00 committed by Scott Lahteine
parent 3ff7515527
commit 82ca6248e2

View file

@ -45,30 +45,30 @@
* *
* "G" Codes * "G" Codes
* *
* G0 -> G1 * G0 -> G1
* G1 - Coordinated Movement X Y Z E * G1 - Coordinated Movement X Y Z E
* G2 - CW ARC * G2 - CW ARC
* G3 - CCW ARC * G3 - CCW ARC
* G4 - Dwell S<seconds> or P<milliseconds> * G4 - Dwell S<seconds> or P<milliseconds>
* G5 - Cubic B-spline with XYZE destination and IJPQ offsets * G5 - Cubic B-spline with XYZE destination and IJPQ offsets
* G7 - Coordinated move between UBL mesh points (I & J) * G10 - Retract filament according to settings of M207
* G10 - Retract filament according to settings of M207 * G11 - Retract recover filament according to settings of M208
* G11 - Retract recover filament according to settings of M208 * G12 - Clean tool
* G12 - Clean tool * G20 - Set input units to inches
* G20 - Set input units to inches * G21 - Set input units to millimeters
* G21 - Set input units to millimeters * G26 - Mesh Validation Pattern (Requires UBL_G26_MESH_VALIDATION)
* G26 - Mesh Validation Pattern (Requires UBL_G26_MESH_VALIDATION) * G27 - Park Nozzle (Requires NOZZLE_PARK_FEATURE)
* G27 - Park Nozzle (Requires NOZZLE_PARK_FEATURE) * G28 - Home one or more axes
* G28 - Home one or more axes * G29 - Detailed Z probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
* G29 - Detailed Z probe, probes the bed at 3 or more points. Will fail if you haven't homed yet. * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location)
* G30 - Single Z probe, probes bed at X Y location (defaults to current XY location) * G31 - Dock sled (Z_PROBE_SLED only)
* G31 - Dock sled (Z_PROBE_SLED only) * G32 - Undock sled (Z_PROBE_SLED only)
* G32 - Undock sled (Z_PROBE_SLED only) * G33 - Delta Auto-Calibration (Requires DELTA_AUTO_CALIBRATION)
* G33 - Delta Auto-Calibration (Requires DELTA_AUTO_CALIBRATION) * G38 - Probe target - similar to G28 except it uses the Z_MIN_PROBE for all three axes
* G38 - Probe target - similar to G28 except it uses the Z_MIN_PROBE for all three axes * G42 - Coordinated move to a mesh point (Requires AUTO_BED_LEVELING_UBL)
* G90 - Use Absolute Coordinates * G90 - Use Absolute Coordinates
* G91 - Use Relative Coordinates * G91 - Use Relative Coordinates
* G92 - Set current position to coordinates given * G92 - Set current position to coordinates given
* *
* "M" Codes * "M" Codes
* *
@ -3396,44 +3396,6 @@ inline void gcode_G4() {
#endif // BEZIER_CURVE_SUPPORT #endif // BEZIER_CURVE_SUPPORT
#if ENABLED(AUTO_BED_LEVELING_UBL) //todo: enable for other leveling systems?
/**
* G7: Move X & Y axes to mesh coordinates
*/
inline void gcode_G7(
#if IS_SCARA
bool fast_move=false
#endif
) {
if (IsRunning()) {
const bool hasI = code_seen('I');
const int8_t ix = code_has_value() ? code_value_int() : 0;
const bool hasJ = code_seen('J');
const int8_t iy = code_has_value() ? code_value_int() : 0;
if ((hasI && !WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) || (hasJ && !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1))) {
SERIAL_ECHOLNPGM(MSG_ERR_MESH_XY);
return;
}
destination[X_AXIS] = hasI ? ubl.mesh_index_to_xpos(ix) : current_position[X_AXIS];
destination[Y_AXIS] = hasJ ? ubl.mesh_index_to_ypos(iy) : current_position[Y_AXIS];
destination[Z_AXIS] = current_position[Z_AXIS]; //todo: perhaps add Z-move support?
destination[E_AXIS] = current_position[E_AXIS];
if (code_seen('F') && code_value_linear_units() > 0.0)
feedrate_mm_s = MMM_TO_MMS(code_value_linear_units());
#if IS_SCARA
fast_move ? prepare_uninterpolated_move_to_destination() : prepare_move_to_destination();
#else
prepare_move_to_destination();
#endif
}
}
#endif
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
/** /**
@ -5500,7 +5462,6 @@ void home_all_axes() { gcode_G28(true); }
#endif // HAS_BED_PROBE #endif // HAS_BED_PROBE
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
static bool G38_run_probe() { static bool G38_run_probe() {
@ -5590,6 +5551,45 @@ void home_all_axes() { gcode_G28(true); }
#endif // G38_PROBE_TARGET #endif // G38_PROBE_TARGET
#if ENABLED(AUTO_BED_LEVELING_UBL)
/**
* G42: Move X & Y axes to mesh coordinates (I & J)
*/
inline void gcode_G42(
#if IS_SCARA
bool fast_move=false
#endif
) {
if (IsRunning()) {
const bool hasI = code_seen('I');
const int8_t ix = code_has_value() ? code_value_int() : 0;
const bool hasJ = code_seen('J');
const int8_t iy = code_has_value() ? code_value_int() : 0;
if ((hasI && !WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) || (hasJ && !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1))) {
SERIAL_ECHOLNPGM(MSG_ERR_MESH_XY);
return;
}
destination[X_AXIS] = hasI ? ubl.mesh_index_to_xpos(ix) : current_position[X_AXIS];
destination[Y_AXIS] = hasJ ? ubl.mesh_index_to_ypos(iy) : current_position[Y_AXIS];
destination[Z_AXIS] = current_position[Z_AXIS]; //todo: perhaps add Z-move support?
destination[E_AXIS] = current_position[E_AXIS];
if (code_seen('F') && code_value_linear_units() > 0.0)
feedrate_mm_s = MMM_TO_MMS(code_value_linear_units());
#if IS_SCARA
fast_move ? prepare_uninterpolated_move_to_destination() : prepare_move_to_destination();
#else
prepare_move_to_destination();
#endif
}
}
#endif // AUTO_BED_LEVELING_UBL
/** /**
* G92: Set current position to given X Y Z E * G92: Set current position to given X Y Z E
*/ */
@ -10061,16 +10061,6 @@ void process_next_command() {
break; break;
#endif // BEZIER_CURVE_SUPPORT #endif // BEZIER_CURVE_SUPPORT
#if ENABLED(AUTO_BED_LEVELING_UBL)
case 7:
#if IS_SCARA
gcode_G7(codenum == 0);
#else
gcode_G7();
#endif
break;
#endif
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
case 10: // G10: retract case 10: // G10: retract
case 11: // G11: retract_recover case 11: // G11: retract_recover
@ -10162,6 +10152,17 @@ void process_next_command() {
case 92: // G92 case 92: // G92
gcode_G92(); gcode_G92();
break; break;
#if ENABLED(AUTO_BED_LEVELING_UBL)
case 42:
#if IS_SCARA
gcode_G42(codenum == 0);
#else
gcode_G42();
#endif
break;
#endif
} }
break; break;