mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 15:26:18 +00:00
🚸 Fix G30 behavior
Co-Authored-By: David Fries <2767875+dfries@users.noreply.github.com>
This commit is contained in:
parent
266786406c
commit
25e5a3597f
@ -53,15 +53,21 @@
|
||||
*/
|
||||
void GcodeSuite::G30() {
|
||||
|
||||
xy_pos_t old_pos = current_position,
|
||||
probepos = current_position;
|
||||
|
||||
const bool seenX = parser.seenval('X');
|
||||
if (seenX) probepos.x = RAW_X_POSITION(parser.value_linear_units());
|
||||
const bool seenY = parser.seenval('Y');
|
||||
if (seenY) probepos.y = RAW_Y_POSITION(parser.value_linear_units());
|
||||
|
||||
probe.use_probing_tool();
|
||||
|
||||
// Convert the given logical position to native position
|
||||
const xy_pos_t pos = {
|
||||
parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position.x,
|
||||
parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position.y
|
||||
};
|
||||
if (probe.can_reach(probepos)) {
|
||||
|
||||
if (seenX) old_pos.x = probepos.x;
|
||||
if (seenY) old_pos.y = probepos.y;
|
||||
|
||||
if (probe.can_reach(pos)) {
|
||||
// Disable leveling so the planner won't mess with us
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
|
||||
|
||||
@ -74,15 +80,15 @@ void GcodeSuite::G30() {
|
||||
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
|
||||
|
||||
TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool()));
|
||||
const float measured_z = probe.probe_at_point(pos, raise_after, 1);
|
||||
const float measured_z = probe.probe_at_point(probepos, raise_after, 1);
|
||||
TERN_(HAS_PTC, ptc.set_enabled(true));
|
||||
if (!isnan(measured_z)) {
|
||||
SERIAL_ECHOLNPGM("Bed X: ", pos.asLogical().x, " Y: ", pos.asLogical().y, " Z: ", measured_z);
|
||||
SERIAL_ECHOLNPGM("Bed X: ", probepos.asLogical().x, " Y: ", probepos.asLogical().y, " Z: ", measured_z);
|
||||
#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
|
||||
char msg[31], str_1[6], str_2[6], str_3[6];
|
||||
sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"),
|
||||
dtostrf(pos.x, 1, 1, str_1),
|
||||
dtostrf(pos.y, 1, 1, str_2),
|
||||
dtostrf(probepos.x, 1, 1, str_1),
|
||||
dtostrf(probepos.y, 1, 1, str_2),
|
||||
dtostrf(measured_z, 1, 2, str_3)
|
||||
);
|
||||
ui.set_status(msg);
|
||||
@ -91,6 +97,8 @@ void GcodeSuite::G30() {
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
|
||||
do_blocking_move_to(old_pos);
|
||||
|
||||
if (raise_after == PROBE_PT_STOW)
|
||||
probe.move_z_after_probing();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user