|
@@ -5551,16 +5551,12 @@ void home_all_axes() { gcode_G28(true); }
|
5551
|
5551
|
|
5552
|
5552
|
#endif // G38_PROBE_TARGET
|
5553
|
5553
|
|
5554
|
|
-#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
5554
|
+#if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING)
|
5555
|
5555
|
|
5556
|
5556
|
/**
|
5557
|
5557
|
* G42: Move X & Y axes to mesh coordinates (I & J)
|
5558
|
5558
|
*/
|
5559
|
|
- inline void gcode_G42(
|
5560
|
|
- #if IS_SCARA
|
5561
|
|
- bool fast_move=false
|
5562
|
|
- #endif
|
5563
|
|
- ) {
|
|
5559
|
+ inline void gcode_G42() {
|
5564
|
5560
|
if (IsRunning()) {
|
5565
|
5561
|
const bool hasI = code_seen('I');
|
5566
|
5562
|
const int8_t ix = code_has_value() ? code_value_int() : 0;
|
|
@@ -5572,16 +5568,31 @@ void home_all_axes() { gcode_G28(true); }
|
5572
|
5568
|
return;
|
5573
|
5569
|
}
|
5574
|
5570
|
|
5575
|
|
- destination[X_AXIS] = hasI ? ubl.mesh_index_to_xpos(ix) : current_position[X_AXIS];
|
5576
|
|
- destination[Y_AXIS] = hasJ ? ubl.mesh_index_to_ypos(iy) : current_position[Y_AXIS];
|
5577
|
|
- destination[Z_AXIS] = current_position[Z_AXIS]; //todo: perhaps add Z-move support?
|
5578
|
|
- destination[E_AXIS] = current_position[E_AXIS];
|
|
5571
|
+ #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
5572
|
+ #define _GET_MESH_X(I) bilinear_start[X_AXIS] + I * bilinear_grid_spacing[X_AXIS]
|
|
5573
|
+ #define _GET_MESH_Y(J) bilinear_start[Y_AXIS] + J * bilinear_grid_spacing[Y_AXIS]
|
|
5574
|
+ #elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
5575
|
+ #define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I)
|
|
5576
|
+ #define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J)
|
|
5577
|
+ #elif ENABLED(MESH_BED_LEVELING)
|
|
5578
|
+ #define _GET_MESH_X(I) mbl.index_to_xpos[I]
|
|
5579
|
+ #define _GET_MESH_Y(J) mbl.index_to_ypos[J]
|
|
5580
|
+ #endif
|
|
5581
|
+
|
|
5582
|
+ set_destination_to_current();
|
|
5583
|
+ if (hasI) destination[X_AXIS] = LOGICAL_X_POSITION(_GET_MESH_X(ix));
|
|
5584
|
+ if (hasJ) destination[Y_AXIS] = LOGICAL_Y_POSITION(_GET_MESH_Y(iy));
|
|
5585
|
+ if (code_seen('P') && code_value_bool()) {
|
|
5586
|
+ if (hasI) destination[X_AXIS] -= X_PROBE_OFFSET_FROM_EXTRUDER;
|
|
5587
|
+ if (hasJ) destination[Y_AXIS] -= Y_PROBE_OFFSET_FROM_EXTRUDER;
|
|
5588
|
+ }
|
5579
|
5589
|
|
5580
|
5590
|
if (code_seen('F') && code_value_linear_units() > 0.0)
|
5581
|
5591
|
feedrate_mm_s = MMM_TO_MMS(code_value_linear_units());
|
5582
|
5592
|
|
|
5593
|
+ // SCARA kinematic has "safe" XY raw moves
|
5583
|
5594
|
#if IS_SCARA
|
5584
|
|
- fast_move ? prepare_uninterpolated_move_to_destination() : prepare_move_to_destination();
|
|
5595
|
+ prepare_uninterpolated_move_to_destination();
|
5585
|
5596
|
#else
|
5586
|
5597
|
prepare_move_to_destination();
|
5587
|
5598
|
#endif
|
|
@@ -6399,8 +6410,8 @@ inline void gcode_M42() {
|
6399
|
6410
|
|
6400
|
6411
|
bool stow_probe_after_each = code_seen('E');
|
6401
|
6412
|
|
6402
|
|
- float X_probe_location = code_seen('X') ? code_value_linear_units() : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
|
6403
|
|
- float Y_probe_location = code_seen('Y') ? code_value_linear_units() : Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
|
6413
|
+ const float X_probe_location = code_seen('X') ? code_value_linear_units() : X_current + X_PROBE_OFFSET_FROM_EXTRUDER,
|
|
6414
|
+ Y_probe_location = code_seen('Y') ? code_value_linear_units() : Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
6404
|
6415
|
|
6405
|
6416
|
#if DISABLED(DELTA)
|
6406
|
6417
|
if (!WITHIN(X_probe_location, LOGICAL_X_POSITION(MIN_PROBE_X), LOGICAL_X_POSITION(MAX_PROBE_X))) {
|
|
@@ -10153,13 +10164,9 @@ void process_next_command() {
|
10153
|
10164
|
gcode_G92();
|
10154
|
10165
|
break;
|
10155
|
10166
|
|
10156
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
10167
|
+ #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING)
|
10157
|
10168
|
case 42:
|
10158
|
|
- #if IS_SCARA
|
10159
|
|
- gcode_G42(codenum == 0);
|
10160
|
|
- #else
|
10161
|
|
- gcode_G42();
|
10162
|
|
- #endif
|
|
10169
|
+ gcode_G42();
|
10163
|
10170
|
break;
|
10164
|
10171
|
#endif
|
10165
|
10172
|
|