@@ -58,16 +58,13 @@ void GcodeSuite::G30() {
5858 tool_change (0 );
5959 #endif
6060
61- const xy_pos_t pos = { parser.linearval (' X' , current_position.x + probe.offset_xy .x ),
62- parser.linearval (' Y' , current_position.y + probe.offset_xy .y ) };
61+ // Convert the given logical position to native position
62+ const xy_pos_t pos = {
63+ parser.seenval (' X' ) ? RAW_X_POSITION (parser.value_linear_units ()) : current_position.x ,
64+ parser.seenval (' Y' ) ? RAW_Y_POSITION (parser.value_linear_units ()) : current_position.y
65+ };
6366
64- if (!probe.can_reach (pos)) {
65- #if ENABLED(DWIN_LCD_PROUI)
66- SERIAL_ECHOLNF (GET_EN_TEXT_F (MSG_ZPROBE_OUT));
67- LCD_MESSAGE (MSG_ZPROBE_OUT);
68- #endif
69- }
70- else {
67+ if (probe.can_reach (pos)) {
7168 // Disable leveling so the planner won't mess with us
7269 TERN_ (HAS_LEVELING, set_bed_leveling_enabled (false ));
7370
@@ -83,7 +80,7 @@ void GcodeSuite::G30() {
8380 const float measured_z = probe.probe_at_point (pos, raise_after, 1 );
8481 TERN_ (HAS_PTC, ptc.set_enabled (true ));
8582 if (!isnan (measured_z)) {
86- SERIAL_ECHOLNPGM (" Bed X: " , pos.x , " Y: " , pos.y , " Z: " , measured_z);
83+ SERIAL_ECHOLNPGM (" Bed X: " , pos.asLogical (). x , " Y: " , pos. asLogical () .y , " Z: " , measured_z);
8784 #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
8885 char msg[31 ], str_1[6 ], str_2[6 ], str_3[6 ];
8986 sprintf_P (msg, PSTR (" X:%s, Y:%s, Z:%s" ),
@@ -102,6 +99,12 @@ void GcodeSuite::G30() {
10299
103100 report_current_position ();
104101 }
102+ else {
103+ #if ENABLED(DWIN_LCD_PROUI)
104+ SERIAL_ECHOLNF (GET_EN_TEXT_F (MSG_ZPROBE_OUT));
105+ LCD_MESSAGE (MSG_ZPROBE_OUT);
106+ #endif
107+ }
105108
106109 // Restore the active tool
107110 TERN_ (HAS_MULTI_HOTEND, tool_change (old_tool_index));
0 commit comments