Merge upstream changes from Marlin 2.1.1
This commit is contained in:
@@ -29,6 +29,18 @@
|
||||
#include "../../module/probe.h"
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
|
||||
#if HAS_PTC
|
||||
#include "../../feature/probe_temp_comp.h"
|
||||
#endif
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
#include "../../module/tool_change.h"
|
||||
#endif
|
||||
|
||||
#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
|
||||
#include "../../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* G30: Do a single Z probe at the current XY
|
||||
*
|
||||
@@ -37,30 +49,62 @@
|
||||
* X Probe X position (default current X)
|
||||
* Y Probe Y position (default current Y)
|
||||
* E Engage the probe for each probe (default 1)
|
||||
* C Enable probe temperature compensation (0 or 1, default 1)
|
||||
*/
|
||||
void GcodeSuite::G30() {
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
const uint8_t old_tool_index = active_extruder;
|
||||
tool_change(0);
|
||||
#endif
|
||||
|
||||
const xy_pos_t pos = { parser.linearval('X', current_position.x + probe.offset_xy.x),
|
||||
parser.linearval('Y', current_position.y + probe.offset_xy.y) };
|
||||
|
||||
if (!probe.can_reach(pos)) return;
|
||||
if (!probe.can_reach(pos)) {
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT));
|
||||
LCD_MESSAGE(MSG_ZPROBE_OUT);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// Disable leveling so the planner won't mess with us
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
|
||||
|
||||
// Disable leveling so the planner won't mess with us
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
|
||||
remember_feedrate_scaling_off();
|
||||
|
||||
remember_feedrate_scaling_off();
|
||||
#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
|
||||
process_subcommands_now(F("G28O"));
|
||||
#endif
|
||||
|
||||
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
|
||||
const float measured_z = probe.probe_at_point(pos, raise_after, 1);
|
||||
if (!isnan(measured_z))
|
||||
SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z);
|
||||
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool()));
|
||||
const float measured_z = probe.probe_at_point(pos, raise_after, 1);
|
||||
TERN_(HAS_PTC, ptc.set_enabled(true));
|
||||
if (!isnan(measured_z)) {
|
||||
SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.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(measured_z, 1, 2, str_3)
|
||||
);
|
||||
ui.set_status(msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (raise_after == PROBE_PT_STOW)
|
||||
probe.move_z_after_probing();
|
||||
restore_feedrate_and_scaling();
|
||||
|
||||
report_current_position();
|
||||
if (raise_after == PROBE_PT_STOW)
|
||||
probe.move_z_after_probing();
|
||||
|
||||
report_current_position();
|
||||
}
|
||||
|
||||
// Restore the active tool
|
||||
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index));
|
||||
}
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
|
Reference in New Issue
Block a user