Skip to content

Commit c5a2e41

Browse files
jamespearson04thinkyheaddfries
authored
🐛 Probe behavior corrections (MarlinFirmware#25631)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com> Co-authored-by: David Fries <2767875+dfries@users.noreply.github.com>
1 parent 7d95928 commit c5a2e41

File tree

15 files changed

+113
-82
lines changed

15 files changed

+113
-82
lines changed

Marlin/Configuration.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@
17251725
//#define Z_CLEARANCE_FOR_HOMING 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...
17261726
// Be sure to have this much clearance over your Z_MAX_POS to prevent grinding.
17271727

1728-
//#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing Z
1728+
//#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing (if Z was homed)
17291729

17301730
// Direction of endstops when homing; 1=MAX, -1=MIN
17311731
// :[-1,1]

Marlin/Configuration_adv.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@
924924

925925
//#define QUICK_HOME // If G28 contains XY do a diagonal move first
926926
//#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X
927-
//#define HOME_Z_FIRST // Home Z first. Requires a Z-MIN endstop (not a probe).
927+
//#define HOME_Z_FIRST // Home Z first. Requires a real endstop (not a probe).
928928
//#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first
929929

930930
// @section bltouch

Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp

+8-11
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
* If omitted, the nozzle will raise by Z_CLEARANCE_BETWEEN_PROBES.
113113
*
114114
* H # Offset With P4, 'H' specifies the Offset above the mesh height to place the nozzle.
115-
* If omitted, Z_CLEARANCE_BETWEEN_PROBES will be used.
115+
* If omitted, Z_TWEEN_SAFE_CLEARANCE will be used.
116116
*
117117
* I # Invalidate Invalidate the specified number of Mesh Points near the given 'X' 'Y'. If X or Y are omitted,
118118
* the nozzle location is used. If no 'I' value is given, only the point nearest to the location
@@ -790,10 +790,7 @@ void unified_bed_leveling::shift_mesh_height() {
790790

791791
if (best.pos.x >= 0) { // mesh point found and is reachable by probe
792792
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(best.pos, ExtUI::G29_POINT_START));
793-
const float measured_z = probe.probe_at_point(
794-
best.meshpos(),
795-
stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity
796-
);
793+
const float measured_z = probe.probe_at_point(best.meshpos(), stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity);
797794
z_values[best.pos.x][best.pos.y] = measured_z;
798795
#if ENABLED(EXTENSIBLE_UI)
799796
ExtUI::onMeshUpdate(best.pos, ExtUI::G29_POINT_FINISH);
@@ -1034,9 +1031,9 @@ void set_message_with_feedback(FSTR_P const fstr) {
10341031
save_ubl_active_state_and_disable();
10351032

10361033
LCD_MESSAGE(MSG_UBL_FINE_TUNE_MESH);
1037-
ui.capture(); // Take over control of the LCD encoder
1034+
ui.capture(); // Take over control of the LCD encoder
10381035

1039-
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance
1036+
do_blocking_move_to_xy_z(pos, Z_TWEEN_SAFE_CLEARANCE); // Move to the given XY with probe clearance
10401037

10411038
MeshFlags done_flags{0};
10421039
const xy_int8_t &lpos = location.pos;
@@ -1053,7 +1050,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
10531050

10541051
done_flags.mark(lpos); // Mark this location as 'adjusted' so a new
10551052
// location is used on the next loop
1056-
const xyz_pos_t raw = { get_mesh_x(lpos.x), get_mesh_y(lpos.y), Z_CLEARANCE_BETWEEN_PROBES };
1053+
const xyz_pos_t raw = { get_mesh_x(lpos.x), get_mesh_y(lpos.y), Z_TWEEN_SAFE_CLEARANCE };
10571054

10581055
if (!position_is_reachable(raw)) break; // SHOULD NOT OCCUR (find_closest_mesh_point_of_type only returns reachable)
10591056

@@ -1063,7 +1060,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
10631060

10641061
KEEPALIVE_STATE(PAUSED_FOR_USER);
10651062

1066-
if (do_ubl_mesh_map) display_map(param.T_map_type); // Display the current point
1063+
if (do_ubl_mesh_map) display_map(param.T_map_type); // Display the current point
10671064

10681065
#if IS_TFTGLCD_PANEL
10691066
ui.ubl_plot(lpos.x, lpos.y); // update plot screen
@@ -1093,7 +1090,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
10931090
// Button held down? Abort editing
10941091
if (_click_and_hold([]{
10951092
ui.return_to_status();
1096-
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
1093+
do_z_clearance(Z_TWEEN_SAFE_CLEARANCE);
10971094
set_message_with_feedback(GET_TEXT_F(MSG_EDITING_STOPPED));
10981095
})) break;
10991096

@@ -1113,7 +1110,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
11131110
if (do_ubl_mesh_map) display_map(param.T_map_type);
11141111
restore_ubl_active_state_and_leave();
11151112

1116-
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES);
1113+
do_blocking_move_to_xy_z(pos, Z_TWEEN_SAFE_CLEARANCE);
11171114

11181115
LCD_MESSAGE(MSG_UBL_DONE_EDITING_MESH);
11191116
SERIAL_ECHOLNPGM("Done Editing Mesh");

Marlin/src/gcode/bedlevel/G35.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void GcodeSuite::G35() {
9898

9999
// Probe all positions
100100
LOOP_L_N(i, G35_PROBE_COUNT) {
101-
const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE, 0, true);
101+
const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE);
102102
if (isnan(z_probed_height)) {
103103
SERIAL_ECHOPGM("G35 failed at point ", i + 1, " (");
104104
SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));

Marlin/src/gcode/calibrate/G28.cpp

+26-15
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ void GcodeSuite::G28() {
356356

357357
endstops.enable(true); // Enable endstops for next homing move
358358

359+
bool finalRaiseZ = false;
360+
359361
#if ENABLED(DELTA)
360362

361363
constexpr bool doZ = true; // for NANODLP_Z_SYNC if your DLP is on a DELTA
@@ -407,8 +409,9 @@ void GcodeSuite::G28() {
407409

408410
UNUSED(needZ); UNUSED(homeZZ);
409411

410-
// Z may home first, e.g., when homing away from the bed
411-
TERN_(HOME_Z_FIRST, if (doZ) homeaxis(Z_AXIS));
412+
// Z may home first, e.g., when homing away from the bed.
413+
// This is also permitted when homing with a Z endstop.
414+
if (TERN0(HOME_Z_FIRST, doZ)) homeaxis(Z_AXIS);
412415

413416
// 'R' to specify a specific raise. 'R0' indicates no raise, e.g., for recovery.resume
414417
// When 'R0' is used, there should already be adequate clearance, e.g., from homing Z to max.
@@ -517,7 +520,10 @@ void GcodeSuite::G28() {
517520
#else
518521
homeaxis(Z_AXIS);
519522
#endif
520-
do_move_after_z_homing();
523+
524+
#if EITHER(Z_HOME_TO_MIN, ALLOW_Z_AFTER_HOMING)
525+
finalRaiseZ = true;
526+
#endif
521527
}
522528
#endif
523529

@@ -575,18 +581,6 @@ void GcodeSuite::G28() {
575581
// Clear endstop state for polled stallGuard endstops
576582
TERN_(SPI_ENDSTOPS, endstops.clear_endstop_state());
577583

578-
// Move to a height where we can use the full xy-area
579-
TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height));
580-
581-
TERN_(CAN_SET_LEVELING_AFTER_G28, if (leveling_restore_state) set_bed_leveling_enabled());
582-
583-
restore_feedrate_and_scaling();
584-
585-
// Restore the active tool after homing
586-
#if HAS_MULTI_HOTEND && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
587-
tool_change(old_tool_index, TERN(PARKING_EXTRUDER, !pe_final_change_must_unpark, DISABLED(DUAL_X_CARRIAGE))); // Do move if one of these
588-
#endif
589-
590584
#if HAS_HOMING_CURRENT
591585
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Restore driver current...");
592586
#if HAS_CURRENT_HOME(X)
@@ -627,6 +621,23 @@ void GcodeSuite::G28() {
627621
#endif
628622
#endif // HAS_HOMING_CURRENT
629623

624+
// Move to a height where we can use the full xy-area
625+
TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height));
626+
627+
// Move to the configured Z only if Z was homed to MIN, because machines that
628+
// home to MAX historically expect 'G28 Z' to be safe to use at the end of a
629+
// print, and do_move_after_z_homing is not very nuanced.
630+
if (finalRaiseZ) do_move_after_z_homing();
631+
632+
TERN_(CAN_SET_LEVELING_AFTER_G28, if (leveling_restore_state) set_bed_leveling_enabled());
633+
634+
// Restore the active tool after homing
635+
#if HAS_MULTI_HOTEND && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
636+
tool_change(old_tool_index, TERN(PARKING_EXTRUDER, !pe_final_change_must_unpark, DISABLED(DUAL_X_CARRIAGE))); // Do move if one of these
637+
#endif
638+
639+
restore_feedrate_and_scaling();
640+
630641
ui.refresh();
631642

632643
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_HomingDone());

Marlin/src/gcode/calibrate/G33.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static float std_dev_points(float z_pt[NPP + 1], const bool _0p_cal, const bool
170170
*/
171171
static float calibration_probe(const xy_pos_t &xy, const bool stow, const bool probe_at_offset) {
172172
#if HAS_BED_PROBE
173-
return probe.probe_at_point(xy, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, probe_at_offset, false);
173+
return probe.probe_at_point(xy, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, probe_at_offset, false, Z_PROBE_LOW_POINT, Z_TWEEN_SAFE_CLEARANCE, true);
174174
#else
175175
UNUSED(stow);
176176
return lcd_probe_pt(xy);

Marlin/src/gcode/calibrate/G34_M422.cpp

+8-19
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ void GcodeSuite::G34() {
153153
const xy_pos_t diff = z_stepper_align.xy[i] - z_stepper_align.xy[j];
154154
return HYPOT2(diff.x, diff.y);
155155
};
156-
float z_probe = (Z_PROBE_SAFE_CLEARANCE) + (G34_MAX_GRADE) * 0.01f * SQRT(_MAX(0, magnitude2(0, 1)
156+
const float zoffs = (probe.offset.z < 0) ? -probe.offset.z : 0.0f;
157+
float z_probe = (Z_TWEEN_SAFE_CLEARANCE + zoffs) + (G34_MAX_GRADE) * 0.01f * SQRT(_MAX(0, magnitude2(0, 1)
157158
#if TRIPLE_Z
158159
, magnitude2(2, 1), magnitude2(2, 0)
159160
#if QUAD_Z
@@ -165,12 +166,6 @@ void GcodeSuite::G34() {
165166
// Home before the alignment procedure
166167
home_if_needed();
167168

168-
// Move the Z coordinate realm towards the positive - dirty trick
169-
current_position.z += z_probe * 0.5f;
170-
sync_plan_position();
171-
// Now, the Z origin lies below the build plate. That allows to probe deeper, before run_z_probe throws an error.
172-
// This hack is un-done at the end of G34 - either by re-homing, or by using the probed heights of the last iteration.
173-
174169
#if !HAS_Z_STEPPER_ALIGN_STEPPER_XY
175170
float last_z_align_move[NUM_Z_STEPPERS] = ARRAY_N_1(NUM_Z_STEPPERS, 10000.0f);
176171
#else
@@ -213,28 +208,24 @@ void GcodeSuite::G34() {
213208
// iteration odd/even --> downward / upward stepper sequence
214209
const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPERS - 1 - i : i;
215210

216-
// Safe clearance even on an incline
217-
if ((iteration == 0 || i > 0) && z_probe > current_position.z) do_blocking_move_to_z(z_probe);
218-
219211
xy_pos_t &ppos = z_stepper_align.xy[iprobe];
220212

221-
if (DEBUGGING(LEVELING))
222-
DEBUG_ECHOLNPGM_P(PSTR("Probing X"), ppos.x, SP_Y_STR, ppos.y);
213+
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM_P(PSTR("Probing X"), ppos.x, SP_Y_STR, ppos.y);
223214

224215
// Probe a Z height for each stepper.
225216
// Probing sanity check is disabled, as it would trigger even in normal cases because
226217
// current_position.z has been manually altered in the "dirty trick" above.
227-
const float z_probed_height = probe.probe_at_point(DIFF_TERN(HAS_HOME_OFFSET, ppos, xy_pos_t(home_offset)), raise_after, 0, true, false);
218+
const float z_probed_height = probe.probe_at_point(DIFF_TERN(HAS_HOME_OFFSET, ppos, xy_pos_t(home_offset)), raise_after, 0, true, false, (Z_PROBE_LOW_POINT) - z_probe * 0.5f, z_probe * 0.5f);
228219
if (isnan(z_probed_height)) {
229-
SERIAL_ECHOLNPGM("Probing failed");
220+
SERIAL_ECHOLNPGM(STR_ERR_PROBING_FAILED);
230221
LCD_MESSAGE(MSG_LCD_PROBING_FAILED);
231222
err_break = true;
232223
break;
233224
}
234225

235226
// Add height to each value, to provide a more useful target height for
236227
// the next iteration of probing. This allows adjustments to be made away from the bed.
237-
z_measured[iprobe] = z_probed_height + (Z_CLEARANCE_BETWEEN_PROBES);
228+
z_measured[iprobe] = z_probed_height + (Z_TWEEN_SAFE_CLEARANCE + zoffs); //do we need to add the clearance to this?
238229

239230
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> Z", iprobe + 1, " measured position is ", z_measured[iprobe]);
240231

@@ -248,7 +239,7 @@ void GcodeSuite::G34() {
248239
// Adapt the next probe clearance height based on the new measurements.
249240
// Safe_height = lowest distance to bed (= highest measurement) plus highest measured misalignment.
250241
z_maxdiff = z_measured_max - z_measured_min;
251-
z_probe = (Z_PROBE_SAFE_CLEARANCE) + z_measured_max + z_maxdiff;
242+
z_probe = (Z_TWEEN_SAFE_CLEARANCE + zoffs) + z_measured_max + z_maxdiff; //Not sure we need z_maxdiff, but leaving it in for safety.
252243

253244
#if HAS_Z_STEPPER_ALIGN_STEPPER_XY
254245
// Replace the initial values in z_measured with calculated heights at
@@ -428,15 +419,13 @@ void GcodeSuite::G34() {
428419
IF_DISABLED(TOUCH_MI_PROBE, probe.stow());
429420

430421
#if ENABLED(HOME_AFTER_G34)
431-
// After this operation the z position needs correction
432-
set_axis_never_homed(Z_AXIS);
433422
// Home Z after the alignment procedure
434423
process_subcommands_now(F("G28Z"));
435424
#else
436425
// Use the probed height from the last iteration to determine the Z height.
437426
// z_measured_min is used, because all steppers are aligned to z_measured_min.
438427
// Ideally, this would be equal to the 'z_probe * 0.5f' which was added earlier.
439-
current_position.z -= z_measured_min - float(Z_CLEARANCE_BETWEEN_PROBES);
428+
current_position.z -= z_measured_min - (Z_TWEEN_SAFE_CLEARANCE + zoffs); //we shouldn't want to subtract the clearance from here right? (Depends if we added it further up)
440429
sync_plan_position();
441430
#endif
442431

Marlin/src/gcode/calibrate/M48.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void GcodeSuite::M48() {
223223
} // n_legs
224224

225225
// Probe a single point
226-
const float pz = probe.probe_at_point(test_position, raise_after, 0);
226+
const float pz = probe.probe_at_point(test_position, raise_after);
227227

228228
// Break the loop if the probe fails
229229
probing_good = !isnan(pz);

Marlin/src/gcode/probe/G30.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void GcodeSuite::G30() {
7777
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
7878

7979
TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool()));
80-
const float measured_z = probe.probe_at_point(probepos, raise_after, 1);
80+
const float measured_z = probe.probe_at_point(probepos, raise_after);
8181
TERN_(HAS_PTC, ptc.set_enabled(true));
8282
if (!isnan(measured_z)) {
8383
SERIAL_ECHOLNPGM("Bed X: ", probepos.asLogical().x, " Y: ", probepos.asLogical().y, " Z: ", measured_z);

Marlin/src/inc/SanityCheck.h

+4
Original file line numberDiff line numberDiff line change
@@ -2350,6 +2350,10 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
23502350
#error "HOME_Z_FIRST can't be used when homing Z with a probe."
23512351
#endif
23522352

2353+
#if Z_HOME_TO_MAX && defined(Z_AFTER_HOMING) && DISABLED(ALLOW_Z_AFTER_HOMING)
2354+
#error "Z_AFTER_HOMING shouldn't be used with Z max homing to keep 'G28 Z' safe for end-of-print usage. Define ALLOW_Z_AFTER_HOMING to allow this at your own risk."
2355+
#endif
2356+
23532357
// Dual/multiple endstops requirements
23542358
#if ENABLED(X_DUAL_ENDSTOPS)
23552359
#if ENABLED(DELTA)

Marlin/src/lcd/e3v2/jyersui/dwin.cpp

+23-13
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,13 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item
14091409
static float mlev_z_pos = 0;
14101410
static bool use_probe = false;
14111411

1412+
#if HAS_BED_PROBE
1413+
constexpr float probe_x_min = _MAX(0 + corner_pos, X_MIN_POS + probe.offset.x, X_MIN_POS + PROBING_MARGIN) - probe.offset.x,
1414+
probe_x_max = _MIN((X_BED_SIZE + X_MIN_POS) - corner_pos, X_MAX_POS + probe.offset.x, X_MAX_POS - PROBING_MARGIN) - probe.offset.x,
1415+
probe_y_min = _MAX(0 + corner_pos, Y_MIN_POS + probe.offset.y, Y_MIN_POS + PROBING_MARGIN) - probe.offset.y,
1416+
probe_y_max = _MIN((Y_BED_SIZE + Y_MIN_POS) - corner_pos, Y_MAX_POS + probe.offset.y, Y_MAX_POS - PROBING_MARGIN) - probe.offset.y;
1417+
#endif
1418+
14121419
switch (item) {
14131420
case MLEVEL_BACK:
14141421
if (draw)
@@ -1425,19 +1432,22 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item
14251432
Draw_Checkbox(row, use_probe);
14261433
}
14271434
else {
1428-
use_probe = !use_probe;
1435+
use_probe ^= true;
14291436
Draw_Checkbox(row, use_probe);
14301437
if (use_probe) {
14311438
Popup_Handler(Level);
1439+
constexpr struct { xy_pos_t p, ProbePtRaise r } points[] = {
1440+
{ { probe_x_min, probe_y_min }, PROBE_PT_RAISE },
1441+
{ { probe_x_min, probe_y_max }, PROBE_PT_RAISE },
1442+
{ { probe_x_max, probe_y_max }, PROBE_PT_RAISE },
1443+
{ { probe_x_max, probe_y_min }, PROBE_PT_STOW }
1444+
};
14321445
corner_avg = 0;
1433-
#define PROBE_X_MIN _MAX(0 + corner_pos, X_MIN_POS + probe.offset.x, X_MIN_POS + PROBING_MARGIN) - probe.offset.x
1434-
#define PROBE_X_MAX _MIN((X_BED_SIZE + X_MIN_POS) - corner_pos, X_MAX_POS + probe.offset.x, X_MAX_POS - PROBING_MARGIN) - probe.offset.x
1435-
#define PROBE_Y_MIN _MAX(0 + corner_pos, Y_MIN_POS + probe.offset.y, Y_MIN_POS + PROBING_MARGIN) - probe.offset.y
1436-
#define PROBE_Y_MAX _MIN((Y_BED_SIZE + Y_MIN_POS) - corner_pos, Y_MAX_POS + probe.offset.y, Y_MAX_POS - PROBING_MARGIN) - probe.offset.y
1437-
corner_avg += probe.probe_at_point(PROBE_X_MIN, PROBE_Y_MIN, PROBE_PT_RAISE, 0, false);
1438-
corner_avg += probe.probe_at_point(PROBE_X_MIN, PROBE_Y_MAX, PROBE_PT_RAISE, 0, false);
1439-
corner_avg += probe.probe_at_point(PROBE_X_MAX, PROBE_Y_MAX, PROBE_PT_RAISE, 0, false);
1440-
corner_avg += probe.probe_at_point(PROBE_X_MAX, PROBE_Y_MIN, PROBE_PT_STOW, 0, false);
1446+
for (uint8_t i = 0; i < COUNT(points); i++) {
1447+
const float mz = probe.probe_at_point(points[i].p, points[i].r, 0, false);
1448+
if (isnan(mz)) { corner_avg = 0; break; }
1449+
corner_avg += mz;
1450+
}
14411451
corner_avg /= 4;
14421452
Redraw_Menu();
14431453
}
@@ -1451,7 +1461,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item
14511461
Popup_Handler(MoveWait);
14521462
if (use_probe) {
14531463
#if HAS_BED_PROBE
1454-
sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MIN, 1, 3, str_1), dtostrf(PROBE_Y_MIN, 1, 3, str_2));
1464+
sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(probe_x_min, 1, 3, str_1), dtostrf(probe_y_min, 1, 3, str_2));
14551465
gcode.process_subcommands_now(cmd);
14561466
planner.synchronize();
14571467
Popup_Handler(ManualProbing);
@@ -1472,7 +1482,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item
14721482
Popup_Handler(MoveWait);
14731483
if (use_probe) {
14741484
#if HAS_BED_PROBE
1475-
sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MIN, 1, 3, str_1), dtostrf(PROBE_Y_MAX, 1, 3, str_2));
1485+
sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(probe_x_min, 1, 3, str_1), dtostrf(probe_y_max, 1, 3, str_2));
14761486
gcode.process_subcommands_now(cmd);
14771487
planner.synchronize();
14781488
Popup_Handler(ManualProbing);
@@ -1493,7 +1503,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item
14931503
Popup_Handler(MoveWait);
14941504
if (use_probe) {
14951505
#if HAS_BED_PROBE
1496-
sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MAX, 1, 3, str_1), dtostrf(PROBE_Y_MAX, 1, 3, str_2));
1506+
sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(probe_x_max, 1, 3, str_1), dtostrf(probe_y_max, 1, 3, str_2));
14971507
gcode.process_subcommands_now(cmd);
14981508
planner.synchronize();
14991509
Popup_Handler(ManualProbing);
@@ -1514,7 +1524,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item
15141524
Popup_Handler(MoveWait);
15151525
if (use_probe) {
15161526
#if HAS_BED_PROBE
1517-
sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MAX, 1, 3, str_1), dtostrf(PROBE_Y_MIN, 1, 3, str_2));
1527+
sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(probe_x_max, 1, 3, str_1), dtostrf(probe_y_min, 1, 3, str_2));
15181528
gcode.process_subcommands_now(cmd);
15191529
planner.synchronize();
15201530
Popup_Handler(ManualProbing);

0 commit comments

Comments
 (0)