BLTOUCH tweaks, new v3.1 command (#14015)

This commit is contained in:
FanDjango
2019-05-18 02:10:18 +02:00
committed by Scott Lahteine
parent 62ef54cb81
commit 85fb33a060
11 changed files with 184 additions and 139 deletions

View File

@ -237,10 +237,6 @@ void GcodeSuite::G28(const bool always_home_all) {
workspace_plane = PLANE_XY;
#endif
#if ENABLED(BLTOUCH)
bltouch.init();
#endif
// Always home with tool 0 active
#if HOTENDS > 1
#if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
@ -353,6 +349,9 @@ void GcodeSuite::G28(const bool always_home_all) {
// Home Z last if homing towards the bed
#if Z_HOME_DIR < 0
if (doZ) {
#if ENABLED(BLTOUCH)
bltouch.init();
#endif
#if ENABLED(Z_SAFE_HOMING)
home_z_safely();
#else

View File

@ -74,7 +74,7 @@ void GcodeSuite::G34() {
do { // break out on error
if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> XY homing required.");
SERIAL_ECHOLNPGM("Home XY first");
break;
}
@ -142,6 +142,14 @@ void GcodeSuite::G34() {
float z_measured_min = 100000.0f;
// For each iteration go through all probe positions (one per Z-Stepper)
for (uint8_t zstepper = 0; zstepper < Z_STEPPER_COUNT; ++zstepper) {
#if BOTH(BLTOUCH, BLTOUCH_HS_MODE)
// In BLTOUCH HS mode, the probe travels in a deployed state.
// Users of G34 might have a badly misaligned bed, so raise Z by the
// length of the deployed pin (BLTOUCH stroke < 7mm)
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES + 7);
#endif
// Probe a Z height for each stepper
z_measured[zstepper] = probe_pt(z_auto_align_xpos[zstepper], z_auto_align_ypos[zstepper], PROBE_PT_RAISE, false);
@ -229,15 +237,19 @@ void GcodeSuite::G34() {
));
#endif
#if HAS_LEVELING
#if ENABLED(RESTORE_LEVELING_AFTER_G34)
set_bed_leveling_enabled(leveling_was_active);
#endif
#if HAS_LEVELING && ENABLED(RESTORE_LEVELING_AFTER_G34)
set_bed_leveling_enabled(leveling_was_active);
#endif
// After this operation the z position needs correction
set_axis_is_not_at_home(Z_AXIS);
#if BOTH(BLTOUCH, BLTOUCH_HS_MODE)
// In BLTOUCH HS mode, the pin is still deployed at this point.
// The upcoming G28 means travel, so it is better to stow the pin.
bltouch._stow();
#endif
gcode.G28(false);
} while(0);