5151 * E Engage the probe for each probe (default 1)
5252 * C Enable probe temperature compensation (0 or 1, default 1)
5353 */
54- void GcodeSuite::G30 ()
55- {
54+ void GcodeSuite::G30 () {
5655 #if HAS_MULTI_HOTEND
5756 const uint8_t old_tool_index = active_extruder;
5857 tool_change (0 );
5958 #endif
6059
61- const xy_pos_t pos = {parser.seenval (' X' ) ? parser.value_linear_units ()
62- #if HAS_POSITION_SHIFT
63- - position_shift.x
64- #endif
65- #if HAS_HOME_OFFSET
66- - home_offset.x
67- #endif
68- : current_position.x ,
69- parser.seenval (' Y' ) ? parser.value_linear_units ()
70- #if HAS_POSITION_SHIFT
71- - position_shift.y
72- #endif
73- #if HAS_HOME_OFFSET
74- - home_offset.y
75- #endif
76- : current_position.y };
77-
78-
79- if (probe.can_reach (pos))
80- {
60+ const xy_pos_t pos = {
61+ parser.seenval (' X' )
62+ ? parser.value_linear_units () TERN_ (HAS_POSITION_SHIFT, - position_shift.x ) TERN_ (HAS_HOME_OFFSET, - home_offset.x )
63+ : current_position.x ,
64+ parser.seenval (' Y' )
65+ ? parser.value_linear_units () TERN_ (HAS_POSITION_SHIFT, - position_shift.y ) TERN_ (HAS_HOME_OFFSET, - home_offset.y )
66+ : current_position.y
67+ };
68+
69+
70+ if (probe.can_reach (pos)) {
8171 // Disable leveling so the planner won't mess with us
8272 TERN_ (HAS_LEVELING, set_bed_leveling_enabled (false ));
8373
@@ -90,7 +80,7 @@ void GcodeSuite::G30()
9080 const ProbePtRaise raise_after = parser.boolval (' E' , true ) ? PROBE_PT_STOW : PROBE_PT_NONE;
9181
9282 TERN_ (HAS_PTC, ptc.set_enabled (!parser.seen (' C' ) || parser.value_bool ()));
93- const float measured_z = probe.probe_at_point (pos, raise_after, true , true );
83+ const float measured_z = probe.probe_at_point (pos, raise_after, 1 , true , true );
9484 TERN_ (HAS_PTC, ptc.set_enabled (true ));
9585 if (!isnan (measured_z)) {
9686 SERIAL_ECHOLNPGM (" Bed X: " , pos.asLogical ().x , " Y: " , pos.asLogical ().y , " Z: " , measured_z);
@@ -112,13 +102,12 @@ void GcodeSuite::G30()
112102
113103 report_current_position ();
114104 }
115- #if ENABLED(DWIN_LCD_PROUI)
116- else
117- {
118- SERIAL_ECHOLNF (GET_EN_TEXT_F (MSG_ZPROBE_OUT));
119- LCD_MESSAGE (MSG_ZPROBE_OUT);
120- }
121- #endif
105+ else {
106+ #if ENABLED(DWIN_LCD_PROUI)
107+ SERIAL_ECHOLNF (GET_EN_TEXT_F (MSG_ZPROBE_OUT));
108+ LCD_MESSAGE (MSG_ZPROBE_OUT);
109+ #endif
110+ }
122111
123112 // Restore the active tool
124113 TERN_ (HAS_MULTI_HOTEND, tool_change (old_tool_index));
0 commit comments