From 85fb33a060354a70348f220085405ae7bfb939c5 Mon Sep 17 00:00:00 2001 From: FanDjango Date: Sat, 18 May 2019 02:10:18 +0200 Subject: [PATCH] BLTOUCH tweaks, new v3.1 command (#14015) --- Marlin/src/feature/bltouch.cpp | 7 +- Marlin/src/feature/bltouch.h | 7 + Marlin/src/gcode/calibrate/G28.cpp | 7 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 22 +- Marlin/src/gcode/config/M43.cpp | 235 ++++++++++++--------- Marlin/src/lcd/language/language_en.h | 3 + Marlin/src/lcd/menu/menu_configuration.cpp | 1 + Marlin/src/module/endstops.cpp | 3 +- Marlin/src/module/motion.cpp | 16 +- Marlin/src/module/probe.cpp | 20 +- config/examples/Anet/E16/_Statusscreen.h | 2 +- 11 files changed, 184 insertions(+), 139 deletions(-) diff --git a/Marlin/src/feature/bltouch.cpp b/Marlin/src/feature/bltouch.cpp index 6166b7d195..2b0b73bc95 100644 --- a/Marlin/src/feature/bltouch.cpp +++ b/Marlin/src/feature/bltouch.cpp @@ -146,19 +146,16 @@ bool BLTouch::status_proc() { /** * Return a TRUE for "YES, it is DEPLOYED" * This function will ensure switch state is reset after execution - * This may change pin position in some scenarios, specifically - * if the pin has been triggered but not yet stowed. */ if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch STATUS requested"); - _set_SW_mode(); + _set_SW_mode(); // Incidentally, _set_SW_mode() will also RESET any active alarm const bool tr = triggered(); // If triggered in SW mode, the pin is up, it is STOWED if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch is ", (int)tr); - _reset(); // turn off the SW Mode - if (tr) _stow(); else _deploy(); // and reset any triggered signal, restore state + if (tr) _stow(); else _deploy(); // Turn off SW mode, reset any trigger, honor pin state return !tr; } diff --git a/Marlin/src/feature/bltouch.h b/Marlin/src/feature/bltouch.h index 70fb22f717..25a1191935 100644 --- a/Marlin/src/feature/bltouch.h +++ b/Marlin/src/feature/bltouch.h @@ -30,6 +30,7 @@ typedef unsigned char BLTCommand; #define BLTOUCH_SW_MODE 60 #define BLTOUCH_STOW 90 #define BLTOUCH_SELFTEST 120 +#define BLTOUCH_MODE_STORE 130 #define BLTOUCH_5V_MODE 140 #define BLTOUCH_OD_MODE 150 #define BLTOUCH_RESET 160 @@ -51,6 +52,9 @@ typedef unsigned char BLTCommand; #ifndef BLTOUCH_SETOD_DELAY #define BLTOUCH_SETOD_DELAY BLTOUCH_DELAY #endif +#ifndef BLTOUCH_MODE_STORE_DELAY + #define BLTOUCH_MODE_STORE_DELAY BLTOUCH_DELAY +#endif #ifndef BLTOUCH_DEPLOY_DELAY #define BLTOUCH_DEPLOY_DELAY 750 #endif @@ -77,8 +81,11 @@ public: FORCE_INLINE static void _selftest() { command(BLTOUCH_SELFTEST, BLTOUCH_DELAY); } FORCE_INLINE static void _set_SW_mode() { command(BLTOUCH_SW_MODE, BLTOUCH_DELAY); } + FORCE_INLINE static void _reset_SW_mode() { if (triggered()) _stow(); else _deploy(); } + FORCE_INLINE static void _set_5V_mode() { command(BLTOUCH_5V_MODE, BLTOUCH_SET5V_DELAY); } FORCE_INLINE static void _set_OD_mode() { command(BLTOUCH_OD_MODE, BLTOUCH_SETOD_DELAY); } + FORCE_INLINE static void _mode_store() { command(BLTOUCH_MODE_STORE, BLTOUCH_MODE_STORE_DELAY); } FORCE_INLINE static void _deploy() { command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); } FORCE_INLINE static void _stow() { command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); } diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 1a6922cfa4..c191eeae3b 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -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 diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 66fa800169..62944ffc3e 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -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); diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index e1445eaf6d..d383e3465e 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -34,6 +34,10 @@ #include "../../module/servo.h" #endif +#if ENABLED(BLTOUCH) + #include "../../feature/bltouch.h" +#endif + #if ENABLED(HOST_PROMPT_SUPPORT) #include "../../feature/host_actions.h" #endif @@ -91,122 +95,152 @@ inline void toggle_pins() { } // toggle_pins inline void servo_probe_test() { + #if !(NUM_SERVOS > 0 && HAS_SERVO_0) - SERIAL_ERROR_MSG("SERVO not setup"); + SERIAL_ERROR_MSG("SERVO not set up."); #elif !HAS_Z_SERVO_PROBE - SERIAL_ERROR_MSG("Z_PROBE_SERVO_NR not setup"); + SERIAL_ERROR_MSG("Z_PROBE_SERVO_NR not set up."); #else // HAS_Z_SERVO_PROBE const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR); - SERIAL_ECHOLNPGM("Servo probe test"); - SERIAL_ECHOLNPAIR(". using index: ", probe_index); - SERIAL_ECHOLNPAIR(". deploy angle: ", servo_angles[probe_index][0]); - SERIAL_ECHOLNPAIR(". stow angle: ", servo_angles[probe_index][1]); + SERIAL_ECHOLNPAIR("Servo probe test\n" + ". using index: ", int(probe_index), + ", deploy angle: ", servo_angles[probe_index][0], + ", stow angle: ", servo_angles[probe_index][1] + ); - bool probe_inverting; + bool deploy_state, stow_state; #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #define PROBE_TEST_PIN Z_MIN_PIN + constexpr bool probe_inverting = Z_MIN_ENDSTOP_INVERTING; - SERIAL_ECHOLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN); - SERIAL_ECHOLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)"); + SERIAL_ECHOLNPAIR(". Probe Z_MIN_PIN: ", int(PROBE_TEST_PIN)); SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: "); - #if Z_MIN_ENDSTOP_INVERTING - SERIAL_ECHOLNPGM("true"); - #else - SERIAL_ECHOLNPGM("false"); - #endif - - probe_inverting = Z_MIN_ENDSTOP_INVERTING; - - #elif USES_Z_MIN_PROBE_ENDSTOP + #else #define PROBE_TEST_PIN Z_MIN_PROBE_PIN - SERIAL_ECHOLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN); - SERIAL_ECHOLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)"); - SERIAL_ECHOPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: "); + constexpr bool probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING; - #if Z_MIN_PROBE_ENDSTOP_INVERTING - SERIAL_ECHOLNPGM("true"); - #else - SERIAL_ECHOLNPGM("false"); - #endif - - probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING; + SERIAL_ECHOLNPAIR(". Probe Z_MIN_PROBE_PIN: ", int(PROBE_TEST_PIN)); + SERIAL_ECHOPGM( ". Z_MIN_PROBE_ENDSTOP_INVERTING: "); #endif - SERIAL_ECHOLNPGM(". deploy & stow 4 times"); + serialprint_truefalse(probe_inverting); + SERIAL_EOL(); + SET_INPUT_PULLUP(PROBE_TEST_PIN); - uint8_t i = 0; - bool deploy_state, stow_state; - do { - MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy - safe_delay(500); - deploy_state = READ(PROBE_TEST_PIN); - MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow - safe_delay(500); - stow_state = READ(PROBE_TEST_PIN); - } while (++i < 4); - if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING - INVERTING setting probably backwards"); - if (deploy_state != stow_state) { - SERIAL_ECHOLNPGM("BLTouch clone detected"); - if (deploy_state) { - SERIAL_ECHOLNPGM(". DEPLOYED state: HIGH (logic 1)"); - SERIAL_ECHOLNPGM(". STOWED (triggered) state: LOW (logic 0)"); + // First, check for a probe that recognizes an advanced BLTouch sequence. + // In addition to STOW and DEPLOY, it uses SW MODE (and RESET in the beginning) + // to see if this is one of the following: BLTOUCH Classic 1.2, 1.3, or + // BLTouch Smart 1.0, 2.0, 2.2, 3.0, 3.1. But only if the user has actually + // configured a BLTouch as being present. If the user has not configured this, + // the BLTouch will be detected in the last phase of these tests (see further on). + bool blt = false; + // This code will try to detect a BLTouch probe or clone + #if ENABLED(BLTOUCH) + SERIAL_ECHOLNPGM(". Check for BLTOUCH"); + bltouch._reset(); + bltouch._stow(); + if (probe_inverting == READ(PROBE_TEST_PIN)) { + bltouch._set_SW_mode(); + if (probe_inverting != READ(PROBE_TEST_PIN)) { + bltouch._deploy(); + if (probe_inverting == READ(PROBE_TEST_PIN)) { + bltouch._stow(); + SERIAL_ECHOLNPGM("= BLTouch Classic 1.2, 1.3, Smart 1.0, 2.0, 2.2, 3.0, 3.1 detected."); + // Check for a 3.1 by letting the user trigger it, later + blt = true; + } } - else { - SERIAL_ECHOLNPGM(". DEPLOYED state: LOW (logic 0)"); - SERIAL_ECHOLNPGM(". STOWED (triggered) state: HIGH (logic 1)"); - } - #if ENABLED(BLTOUCH) - SERIAL_ECHOLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true."); - #endif } - else { // measure active signal length - MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy - safe_delay(500); - SERIAL_ECHOLNPGM("please trigger probe"); - uint16_t probe_counter = 0; + #endif - // Allow 30 seconds max for operator to trigger probe - for (uint16_t j = 0; j < 500 * 30 && probe_counter == 0 ; j++) { + // The following code is common to all kinds of servo probes. + // Since it could be a real servo or a BLTouch (any kind) or a clone, + // use only "common" functions - i.e. SERVO_MOVE. No bltouch.xxxx stuff. - safe_delay(2); + // If it is already recognised as a being a BLTouch, no need for this test + if (!blt) { + // DEPLOY and STOW 4 times and see if the signal follows + // Then it is a mechanical switch + uint8_t i = 0; + SERIAL_ECHOLNPGM(". Deploy & stow 4 times"); + do { + MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy + safe_delay(500); + deploy_state = READ(PROBE_TEST_PIN); + MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow + safe_delay(500); + stow_state = READ(PROBE_TEST_PIN); + } while (++i < 4); - if (0 == j % (500 * 1)) gcode.reset_stepper_timeout(); // Keep steppers powered + if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING: INVERTING setting probably backwards."); - if (deploy_state != READ(PROBE_TEST_PIN)) { // probe triggered + if (deploy_state != stow_state) { + SERIAL_ECHOLNPGM("= Mechanical Switch detected"); + if (deploy_state) { + SERIAL_ECHOLNPAIR(" DEPLOYED state: HIGH (logic 1)", + " STOWED (triggered) state: LOW (logic 0)"); + } + else { + SERIAL_ECHOLNPAIR(" DEPLOYED state: LOW (logic 0)", + " STOWED (triggered) state: HIGH (logic 1)"); + } + #if ENABLED(BLTOUCH) + SERIAL_ECHOLNPGM("FAIL: BLTOUCH enabled - Set up this device as a Servo Probe with INVERTING set to 'true'."); + #endif + return; + } + } - for (probe_counter = 1; probe_counter < 50 && deploy_state != READ(PROBE_TEST_PIN); ++probe_counter) - safe_delay(2); + // Ask the user for a trigger event and measure the pulse width. + MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy + safe_delay(500); + SERIAL_ECHOLNPGM("** Please trigger probe within 30 sec **"); + uint16_t probe_counter = 0; - if (probe_counter == 50) - SERIAL_ECHOLNPGM("Z Servo Probe detected"); // >= 100mS active time - else if (probe_counter >= 2) - SERIAL_ECHOLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse - else - SERIAL_ECHOLNPGM("noise detected - please re-run test"); // less than 2mS pulse + // Wait 30 seconds for user to trigger probe + for (uint16_t j = 0; j < 500 * 30 && probe_counter == 0 ; j++) { + safe_delay(2); - MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow + if (0 == j % (500 * 1)) gcode.reset_stepper_timeout(); // Keep steppers powered - } // pulse detected + if (deploy_state != READ(PROBE_TEST_PIN)) { // probe triggered + for (probe_counter = 0; probe_counter < 15 && deploy_state != READ(PROBE_TEST_PIN); ++probe_counter) safe_delay(2); - } // for loop waiting for trigger + if (probe_counter = 15) + SERIAL_ECHOLNPGM(". Pulse width: 30ms or more"); + else + SERIAL_ECHOLNPAIR(". Pulse width (+/- 4ms): ", probe_counter * 2); + + if (probe_counter >= 4) { + if (probe_counter == 15) { + if (blt) SERIAL_ECHOPGM("= BLTouch V3.1"); + else SERIAL_ECHOPGM("= Z Servo Probe"); + } + else SERIAL_ECHOPGM("= BLTouch pre V3.1 or compatible probe"); + SERIAL_ECHOLNPGM(" detected."); + } + else SERIAL_ECHOLNPGM("FAIL: Noise detected - please re-run test"); - if (probe_counter == 0) SERIAL_ECHOLNPGM("trigger not detected"); + MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow + return; + } + } - } // measure active signal length + if (!probe_counter) SERIAL_ECHOLNPGM("FAIL: Trigger not detected"); - #endif + #endif // HAS_Z_SERVO_PROBE } // servo_probe_test @@ -239,12 +273,10 @@ inline void servo_probe_test() { */ void GcodeSuite::M43() { - if (parser.seen('T')) { // must be first or else its "S" and "E" parameters will execute endstop or servo test - toggle_pins(); - return; - } + // 'T' must be first. It uses 'S' and 'E' differently. + if (parser.seen('T')) return toggle_pins(); - // Enable or disable endstop monitoring + // 'E' Enable or disable endstop monitoring and return if (parser.seen('E')) { endstops.monitor_flag = parser.value_bool(); SERIAL_ECHOPGM("endstop monitor "); @@ -253,25 +285,23 @@ void GcodeSuite::M43() { return; } - if (parser.seen('S')) { - servo_probe_test(); - return; - } + // 'S' Run servo probe test and return + if (parser.seen('S')) return servo_probe_test(); - // Get the range of pins to test or watch + // 'P' Get the range of pins to test or watch uint8_t first_pin = PARSED_PIN_INDEX('P', 0), last_pin = parser.seenval('P') ? first_pin : NUMBER_PINS_TOTAL - 1; if (first_pin > last_pin) return; + // 'I' to ignore protected pins const bool ignore_protection = parser.boolval('I'); - // Watch until click, M108, or reset + // 'W' Watch until click, M108, or reset if (parser.boolval('W')) { SERIAL_ECHOLNPGM("Watching pins"); - #ifdef ARDUINO_ARCH_SAM - NOLESS(first_pin, 2); // don't hijack the UART pins + NOLESS(first_pin, 2); // Don't hijack the UART pins #endif uint8_t pin_state[last_pin - first_pin + 1]; for (uint8_t i = first_pin; i <= last_pin; i++) { @@ -280,11 +310,11 @@ void GcodeSuite::M43() { if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; pinMode(pin, INPUT_PULLUP); delay(1); - /* + /* if (IS_ANALOG(pin)) pin_state[pin - first_pin] = analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)); // int16_t pin_state[...] else - //*/ + //*/ pin_state[i - first_pin] = extDigitalRead(pin); } @@ -303,9 +333,9 @@ void GcodeSuite::M43() { if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; const byte val = /* - IS_ANALOG(pin) - ? analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)) : // int16_t val - : + IS_ANALOG(pin) + ? analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)) : // int16_t val + : //*/ extDigitalRead(pin); if (val != pin_state[i - first_pin]) { @@ -315,21 +345,18 @@ void GcodeSuite::M43() { } #if HAS_RESUME_CONTINUE - if (!wait_for_user) { - KEEPALIVE_STATE(IN_HANDLER); - break; - } + if (!wait_for_user) { KEEPALIVE_STATE(IN_HANDLER); break; } #endif safe_delay(200); } - return; } - - // Report current state of selected pin(s) - for (uint8_t i = first_pin; i <= last_pin; i++) { - pin_t pin = GET_PIN_MAP_PIN(i); - if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true); + else { + // Report current state of selected pin(s) + for (uint8_t i = first_pin; i <= last_pin; i++) { + pin_t pin = GET_PIN_MAP_PIN(i); + if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true); + } } } diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index c361fb8462..939c03a39d 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -918,6 +918,9 @@ #ifndef MSG_BLTOUCH_OD_MODE #define MSG_BLTOUCH_OD_MODE _UxGT("BLTouch OD Mode") #endif +#ifndef MSG_BLTOUCH_MODE_STORE + #define MSG_BLTOUCH_MODE_STORE _UxGT("BLTouch Mode Store") +#endif #ifndef MSG_BLTOUCH_STOW #define MSG_BLTOUCH_STOW _UxGT("Stow BLTouch") #endif diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 25fa2c3dcd..db5ac05314 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -181,6 +181,7 @@ static void lcd_factory_settings() { MENU_ITEM(function, MSG_BLTOUCH_SW_MODE, bltouch._set_SW_mode); MENU_ITEM(function, MSG_BLTOUCH_5V_MODE, bltouch._set_5V_mode); MENU_ITEM(function, MSG_BLTOUCH_OD_MODE, bltouch._set_OD_mode); + MENU_ITEM(function, MSG_BLTOUCH_MODE_STORE, bltouch._mode_store); END_MENU(); } diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index bfb89fb7b5..deba8b33a4 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -465,8 +465,7 @@ void _O2 Endstops::M119() { #endif #endif #if ENABLED(BLTOUCH) - bltouch._reset(); - if (enabled_globally) bltouch._stow(); + bltouch._reset_SW_mode(); #endif } // Endstops::M119 diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 7f1f9172c9..5469b4d691 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1422,8 +1422,7 @@ void homeaxis(const AxisEnum axis) { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 1 Fast:"); #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) - // BLTOUCH needs to be deployed every time - if (axis == Z_AXIS && bltouch.deploy()) return; + if (axis == Z_AXIS && bltouch.deploy()) return; // The initial DEPLOY #endif do_homing_move(axis, 1.5f * max_length( @@ -1435,9 +1434,8 @@ void homeaxis(const AxisEnum axis) { ) * axis_home_dir ); - #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) - // BLTOUCH needs to be stowed after trigger to rearm itself - if (axis == Z_AXIS) bltouch.stow(); + #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE) + if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE) #endif // When homing Z with probe respect probe clearance @@ -1461,16 +1459,14 @@ void homeaxis(const AxisEnum axis) { // Slow move towards endstop until triggered if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 2 Slow:"); - #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) - // BLTOUCH needs to be deployed every time - if (axis == Z_AXIS && bltouch.deploy()) return; + #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE) + if (axis == Z_AXIS && bltouch.deploy()) return; // Intermediate DEPLOY (in LOW SPEED MODE) #endif do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis)); #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) - // BLTOUCH needs to be stowed after trigger to rearm itself - if (axis == Z_AXIS) bltouch.stow(); + if (axis == Z_AXIS) bltouch.stow(); // The final STOW #endif } diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 20afebefd1..207490405d 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -356,9 +356,15 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { dock_sled(!deploy); - #elif HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH) + #elif HAS_Z_SERVO_PROBE - MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); + #if DISABLED(BLTOUCH) + MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); + #elif ENABLED(BLTOUCH_HS_MODE) + // In HIGH SPEED MODE, use the normal retractable probe logic in this code + // i.e. no intermediate STOWs and DEPLOYs in between individual probe actions + if (deploy) bltouch.deploy(); else bltouch.stow(); + #endif #elif ENABLED(Z_PROBE_ALLEN_KEY) @@ -492,9 +498,8 @@ static bool do_probe_move(const float z, const float fr_mm_s) { } #endif - // Deploy BLTouch at the start of any probe - #if ENABLED(BLTOUCH) - if (bltouch.deploy()) return true; + #if ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE) + if (bltouch.deploy()) return true; // DEPLOY in LOW SPEED MODE on every probe action #endif // Disable stealthChop if used. Enable diag1 pin on driver. @@ -544,9 +549,8 @@ static bool do_probe_move(const float z, const float fr_mm_s) { tmc_disable_stallguard(stepperZ, stealth_states.z); #endif - // Retract BLTouch immediately after a probe if it was triggered - #if ENABLED(BLTOUCH) - if (probe_triggered && bltouch.stow()) return true; + #if ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE) + if (probe_triggered && bltouch.stow()) return true; // STOW in LOW SPEED MODE on trigger on every probe action #endif // Clear endstop flags diff --git a/config/examples/Anet/E16/_Statusscreen.h b/config/examples/Anet/E16/_Statusscreen.h index 466e4843c7..3894c4e7d2 100644 --- a/config/examples/Anet/E16/_Statusscreen.h +++ b/config/examples/Anet/E16/_Statusscreen.h @@ -63,7 +63,7 @@ const unsigned char status_logo_bmp[] PROGMEM = { B11110000,B00000000,B00001111, B11111100,B00000000,B00111111, B11111110,B01101100,B01111111, - B11111111,B11111111,B11111111 + B11111111,B11111111,B11111111 }; //