BLTOUCH tweaks, new v3.1 command (#14015)
This commit is contained in:
parent
62ef54cb81
commit
85fb33a060
|
@ -146,19 +146,16 @@ bool BLTouch::status_proc() {
|
||||||
/**
|
/**
|
||||||
* Return a TRUE for "YES, it is DEPLOYED"
|
* Return a TRUE for "YES, it is DEPLOYED"
|
||||||
* This function will ensure switch state is reset after execution
|
* 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");
|
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
|
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);
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch is ", (int)tr);
|
||||||
|
|
||||||
_reset(); // turn off the SW Mode
|
if (tr) _stow(); else _deploy(); // Turn off SW mode, reset any trigger, honor pin state
|
||||||
if (tr) _stow(); else _deploy(); // and reset any triggered signal, restore state
|
|
||||||
return !tr;
|
return !tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ typedef unsigned char BLTCommand;
|
||||||
#define BLTOUCH_SW_MODE 60
|
#define BLTOUCH_SW_MODE 60
|
||||||
#define BLTOUCH_STOW 90
|
#define BLTOUCH_STOW 90
|
||||||
#define BLTOUCH_SELFTEST 120
|
#define BLTOUCH_SELFTEST 120
|
||||||
|
#define BLTOUCH_MODE_STORE 130
|
||||||
#define BLTOUCH_5V_MODE 140
|
#define BLTOUCH_5V_MODE 140
|
||||||
#define BLTOUCH_OD_MODE 150
|
#define BLTOUCH_OD_MODE 150
|
||||||
#define BLTOUCH_RESET 160
|
#define BLTOUCH_RESET 160
|
||||||
|
@ -51,6 +52,9 @@ typedef unsigned char BLTCommand;
|
||||||
#ifndef BLTOUCH_SETOD_DELAY
|
#ifndef BLTOUCH_SETOD_DELAY
|
||||||
#define BLTOUCH_SETOD_DELAY BLTOUCH_DELAY
|
#define BLTOUCH_SETOD_DELAY BLTOUCH_DELAY
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef BLTOUCH_MODE_STORE_DELAY
|
||||||
|
#define BLTOUCH_MODE_STORE_DELAY BLTOUCH_DELAY
|
||||||
|
#endif
|
||||||
#ifndef BLTOUCH_DEPLOY_DELAY
|
#ifndef BLTOUCH_DEPLOY_DELAY
|
||||||
#define BLTOUCH_DEPLOY_DELAY 750
|
#define BLTOUCH_DEPLOY_DELAY 750
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,8 +81,11 @@ public:
|
||||||
FORCE_INLINE static void _selftest() { command(BLTOUCH_SELFTEST, BLTOUCH_DELAY); }
|
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 _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_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 _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 _deploy() { command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
|
||||||
FORCE_INLINE static void _stow() { command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
|
FORCE_INLINE static void _stow() { command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
|
||||||
|
|
|
@ -237,10 +237,6 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||||
workspace_plane = PLANE_XY;
|
workspace_plane = PLANE_XY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(BLTOUCH)
|
|
||||||
bltouch.init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Always home with tool 0 active
|
// Always home with tool 0 active
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
#if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
|
#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
|
// Home Z last if homing towards the bed
|
||||||
#if Z_HOME_DIR < 0
|
#if Z_HOME_DIR < 0
|
||||||
if (doZ) {
|
if (doZ) {
|
||||||
|
#if ENABLED(BLTOUCH)
|
||||||
|
bltouch.init();
|
||||||
|
#endif
|
||||||
#if ENABLED(Z_SAFE_HOMING)
|
#if ENABLED(Z_SAFE_HOMING)
|
||||||
home_z_safely();
|
home_z_safely();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -74,7 +74,7 @@ void GcodeSuite::G34() {
|
||||||
do { // break out on error
|
do { // break out on error
|
||||||
|
|
||||||
if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +142,14 @@ void GcodeSuite::G34() {
|
||||||
float z_measured_min = 100000.0f;
|
float z_measured_min = 100000.0f;
|
||||||
// For each iteration go through all probe positions (one per Z-Stepper)
|
// For each iteration go through all probe positions (one per Z-Stepper)
|
||||||
for (uint8_t zstepper = 0; zstepper < Z_STEPPER_COUNT; ++zstepper) {
|
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
|
// 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);
|
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
|
#endif
|
||||||
|
|
||||||
#if HAS_LEVELING
|
#if HAS_LEVELING && ENABLED(RESTORE_LEVELING_AFTER_G34)
|
||||||
#if ENABLED(RESTORE_LEVELING_AFTER_G34)
|
|
||||||
set_bed_leveling_enabled(leveling_was_active);
|
set_bed_leveling_enabled(leveling_was_active);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
// After this operation the z position needs correction
|
// After this operation the z position needs correction
|
||||||
set_axis_is_not_at_home(Z_AXIS);
|
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);
|
gcode.G28(false);
|
||||||
|
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
#include "../../module/servo.h"
|
#include "../../module/servo.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(BLTOUCH)
|
||||||
|
#include "../../feature/bltouch.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||||
#include "../../feature/host_actions.h"
|
#include "../../feature/host_actions.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -91,62 +95,86 @@ inline void toggle_pins() {
|
||||||
} // toggle_pins
|
} // toggle_pins
|
||||||
|
|
||||||
inline void servo_probe_test() {
|
inline void servo_probe_test() {
|
||||||
|
|
||||||
#if !(NUM_SERVOS > 0 && HAS_SERVO_0)
|
#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
|
#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
|
#else // HAS_Z_SERVO_PROBE
|
||||||
|
|
||||||
const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR);
|
const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR);
|
||||||
|
|
||||||
SERIAL_ECHOLNPGM("Servo probe test");
|
SERIAL_ECHOLNPAIR("Servo probe test\n"
|
||||||
SERIAL_ECHOLNPAIR(". using index: ", probe_index);
|
". using index: ", int(probe_index),
|
||||||
SERIAL_ECHOLNPAIR(". deploy angle: ", servo_angles[probe_index][0]);
|
", deploy angle: ", servo_angles[probe_index][0],
|
||||||
SERIAL_ECHOLNPAIR(". stow angle: ", servo_angles[probe_index][1]);
|
", 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)
|
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||||
|
|
||||||
#define PROBE_TEST_PIN Z_MIN_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_ECHOLNPAIR(". Probe Z_MIN_PIN: ", int(PROBE_TEST_PIN));
|
||||||
SERIAL_ECHOLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)");
|
|
||||||
SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: ");
|
SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: ");
|
||||||
|
|
||||||
#if Z_MIN_ENDSTOP_INVERTING
|
|
||||||
SERIAL_ECHOLNPGM("true");
|
|
||||||
#else
|
#else
|
||||||
SERIAL_ECHOLNPGM("false");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
probe_inverting = Z_MIN_ENDSTOP_INVERTING;
|
|
||||||
|
|
||||||
#elif USES_Z_MIN_PROBE_ENDSTOP
|
|
||||||
|
|
||||||
#define PROBE_TEST_PIN Z_MIN_PROBE_PIN
|
#define PROBE_TEST_PIN Z_MIN_PROBE_PIN
|
||||||
SERIAL_ECHOLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
|
constexpr bool probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
|
||||||
SERIAL_ECHOLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)");
|
|
||||||
|
SERIAL_ECHOLNPAIR(". Probe Z_MIN_PROBE_PIN: ", int(PROBE_TEST_PIN));
|
||||||
SERIAL_ECHOPGM( ". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
|
SERIAL_ECHOPGM( ". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
|
||||||
|
|
||||||
#if Z_MIN_PROBE_ENDSTOP_INVERTING
|
|
||||||
SERIAL_ECHOLNPGM("true");
|
|
||||||
#else
|
|
||||||
SERIAL_ECHOLNPGM("false");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
|
serialprint_truefalse(probe_inverting);
|
||||||
|
SERIAL_EOL();
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SERIAL_ECHOLNPGM(". deploy & stow 4 times");
|
|
||||||
SET_INPUT_PULLUP(PROBE_TEST_PIN);
|
SET_INPUT_PULLUP(PROBE_TEST_PIN);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
// 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;
|
uint8_t i = 0;
|
||||||
bool deploy_state, stow_state;
|
SERIAL_ECHOLNPGM(". Deploy & stow 4 times");
|
||||||
do {
|
do {
|
||||||
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
|
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
|
||||||
safe_delay(500);
|
safe_delay(500);
|
||||||
|
@ -155,58 +183,64 @@ inline void servo_probe_test() {
|
||||||
safe_delay(500);
|
safe_delay(500);
|
||||||
stow_state = READ(PROBE_TEST_PIN);
|
stow_state = READ(PROBE_TEST_PIN);
|
||||||
} while (++i < 4);
|
} while (++i < 4);
|
||||||
if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING - INVERTING setting probably backwards");
|
|
||||||
|
if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING: INVERTING setting probably backwards.");
|
||||||
|
|
||||||
if (deploy_state != stow_state) {
|
if (deploy_state != stow_state) {
|
||||||
SERIAL_ECHOLNPGM("BLTouch clone detected");
|
SERIAL_ECHOLNPGM("= Mechanical Switch detected");
|
||||||
if (deploy_state) {
|
if (deploy_state) {
|
||||||
SERIAL_ECHOLNPGM(". DEPLOYED state: HIGH (logic 1)");
|
SERIAL_ECHOLNPAIR(" DEPLOYED state: HIGH (logic 1)",
|
||||||
SERIAL_ECHOLNPGM(". STOWED (triggered) state: LOW (logic 0)");
|
" STOWED (triggered) state: LOW (logic 0)");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SERIAL_ECHOLNPGM(". DEPLOYED state: LOW (logic 0)");
|
SERIAL_ECHOLNPAIR(" DEPLOYED state: LOW (logic 0)",
|
||||||
SERIAL_ECHOLNPGM(". STOWED (triggered) state: HIGH (logic 1)");
|
" STOWED (triggered) state: HIGH (logic 1)");
|
||||||
}
|
}
|
||||||
#if ENABLED(BLTOUCH)
|
#if ENABLED(BLTOUCH)
|
||||||
SERIAL_ECHOLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
|
SERIAL_ECHOLNPGM("FAIL: BLTOUCH enabled - Set up this device as a Servo Probe with INVERTING set to 'true'.");
|
||||||
#endif
|
#endif
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else { // measure active signal length
|
}
|
||||||
|
|
||||||
|
// Ask the user for a trigger event and measure the pulse width.
|
||||||
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
|
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
|
||||||
safe_delay(500);
|
safe_delay(500);
|
||||||
SERIAL_ECHOLNPGM("please trigger probe");
|
SERIAL_ECHOLNPGM("** Please trigger probe within 30 sec **");
|
||||||
uint16_t probe_counter = 0;
|
uint16_t probe_counter = 0;
|
||||||
|
|
||||||
// Allow 30 seconds max for operator to trigger probe
|
// Wait 30 seconds for user to trigger probe
|
||||||
for (uint16_t j = 0; j < 500 * 30 && probe_counter == 0 ; j++) {
|
for (uint16_t j = 0; j < 500 * 30 && probe_counter == 0 ; j++) {
|
||||||
|
|
||||||
safe_delay(2);
|
safe_delay(2);
|
||||||
|
|
||||||
if (0 == j % (500 * 1)) gcode.reset_stepper_timeout(); // Keep steppers powered
|
if (0 == j % (500 * 1)) gcode.reset_stepper_timeout(); // Keep steppers powered
|
||||||
|
|
||||||
if (deploy_state != READ(PROBE_TEST_PIN)) { // probe triggered
|
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 (probe_counter = 1; probe_counter < 50 && deploy_state != READ(PROBE_TEST_PIN); ++probe_counter)
|
if (probe_counter = 15)
|
||||||
safe_delay(2);
|
SERIAL_ECHOLNPGM(". Pulse width: 30ms or more");
|
||||||
|
|
||||||
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
|
else
|
||||||
SERIAL_ECHOLNPGM("noise detected - please re-run test"); // less than 2mS pulse
|
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");
|
||||||
|
|
||||||
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
|
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // pulse detected
|
if (!probe_counter) SERIAL_ECHOLNPGM("FAIL: Trigger not detected");
|
||||||
|
|
||||||
} // for loop waiting for trigger
|
#endif // HAS_Z_SERVO_PROBE
|
||||||
|
|
||||||
if (probe_counter == 0) SERIAL_ECHOLNPGM("trigger not detected");
|
|
||||||
|
|
||||||
} // measure active signal length
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // servo_probe_test
|
} // servo_probe_test
|
||||||
|
|
||||||
|
@ -239,12 +273,10 @@ inline void servo_probe_test() {
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M43() {
|
void GcodeSuite::M43() {
|
||||||
|
|
||||||
if (parser.seen('T')) { // must be first or else its "S" and "E" parameters will execute endstop or servo test
|
// 'T' must be first. It uses 'S' and 'E' differently.
|
||||||
toggle_pins();
|
if (parser.seen('T')) return toggle_pins();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable or disable endstop monitoring
|
// 'E' Enable or disable endstop monitoring and return
|
||||||
if (parser.seen('E')) {
|
if (parser.seen('E')) {
|
||||||
endstops.monitor_flag = parser.value_bool();
|
endstops.monitor_flag = parser.value_bool();
|
||||||
SERIAL_ECHOPGM("endstop monitor ");
|
SERIAL_ECHOPGM("endstop monitor ");
|
||||||
|
@ -253,25 +285,23 @@ void GcodeSuite::M43() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.seen('S')) {
|
// 'S' Run servo probe test and return
|
||||||
servo_probe_test();
|
if (parser.seen('S')) return servo_probe_test();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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),
|
uint8_t first_pin = PARSED_PIN_INDEX('P', 0),
|
||||||
last_pin = parser.seenval('P') ? first_pin : NUMBER_PINS_TOTAL - 1;
|
last_pin = parser.seenval('P') ? first_pin : NUMBER_PINS_TOTAL - 1;
|
||||||
|
|
||||||
if (first_pin > last_pin) return;
|
if (first_pin > last_pin) return;
|
||||||
|
|
||||||
|
// 'I' to ignore protected pins
|
||||||
const bool ignore_protection = parser.boolval('I');
|
const bool ignore_protection = parser.boolval('I');
|
||||||
|
|
||||||
// Watch until click, M108, or reset
|
// 'W' Watch until click, M108, or reset
|
||||||
if (parser.boolval('W')) {
|
if (parser.boolval('W')) {
|
||||||
SERIAL_ECHOLNPGM("Watching pins");
|
SERIAL_ECHOLNPGM("Watching pins");
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_SAM
|
#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
|
#endif
|
||||||
uint8_t pin_state[last_pin - first_pin + 1];
|
uint8_t pin_state[last_pin - first_pin + 1];
|
||||||
for (uint8_t i = first_pin; i <= last_pin; i++) {
|
for (uint8_t i = first_pin; i <= last_pin; i++) {
|
||||||
|
@ -315,22 +345,19 @@ void GcodeSuite::M43() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_RESUME_CONTINUE
|
#if HAS_RESUME_CONTINUE
|
||||||
if (!wait_for_user) {
|
if (!wait_for_user) { KEEPALIVE_STATE(IN_HANDLER); break; }
|
||||||
KEEPALIVE_STATE(IN_HANDLER);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
safe_delay(200);
|
safe_delay(200);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
// Report current state of selected pin(s)
|
// Report current state of selected pin(s)
|
||||||
for (uint8_t i = first_pin; i <= last_pin; i++) {
|
for (uint8_t i = first_pin; i <= last_pin; i++) {
|
||||||
pin_t pin = GET_PIN_MAP_PIN(i);
|
pin_t pin = GET_PIN_MAP_PIN(i);
|
||||||
if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true);
|
if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // PINS_DEBUGGING
|
#endif // PINS_DEBUGGING
|
||||||
|
|
|
@ -918,6 +918,9 @@
|
||||||
#ifndef MSG_BLTOUCH_OD_MODE
|
#ifndef MSG_BLTOUCH_OD_MODE
|
||||||
#define MSG_BLTOUCH_OD_MODE _UxGT("BLTouch OD Mode")
|
#define MSG_BLTOUCH_OD_MODE _UxGT("BLTouch OD Mode")
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef MSG_BLTOUCH_MODE_STORE
|
||||||
|
#define MSG_BLTOUCH_MODE_STORE _UxGT("BLTouch Mode Store")
|
||||||
|
#endif
|
||||||
#ifndef MSG_BLTOUCH_STOW
|
#ifndef MSG_BLTOUCH_STOW
|
||||||
#define MSG_BLTOUCH_STOW _UxGT("Stow BLTouch")
|
#define MSG_BLTOUCH_STOW _UxGT("Stow BLTouch")
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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_SW_MODE, bltouch._set_SW_mode);
|
||||||
MENU_ITEM(function, MSG_BLTOUCH_5V_MODE, bltouch._set_5V_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_OD_MODE, bltouch._set_OD_mode);
|
||||||
|
MENU_ITEM(function, MSG_BLTOUCH_MODE_STORE, bltouch._mode_store);
|
||||||
END_MENU();
|
END_MENU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -465,8 +465,7 @@ void _O2 Endstops::M119() {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(BLTOUCH)
|
#if ENABLED(BLTOUCH)
|
||||||
bltouch._reset();
|
bltouch._reset_SW_mode();
|
||||||
if (enabled_globally) bltouch._stow();
|
|
||||||
#endif
|
#endif
|
||||||
} // Endstops::M119
|
} // Endstops::M119
|
||||||
|
|
||||||
|
|
|
@ -1422,8 +1422,7 @@ void homeaxis(const AxisEnum axis) {
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 1 Fast:");
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 1 Fast:");
|
||||||
|
|
||||||
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
|
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
|
||||||
// BLTOUCH needs to be deployed every time
|
if (axis == Z_AXIS && bltouch.deploy()) return; // The initial DEPLOY
|
||||||
if (axis == Z_AXIS && bltouch.deploy()) return;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do_homing_move(axis, 1.5f * max_length(
|
do_homing_move(axis, 1.5f * max_length(
|
||||||
|
@ -1435,9 +1434,8 @@ void homeaxis(const AxisEnum axis) {
|
||||||
) * axis_home_dir
|
) * axis_home_dir
|
||||||
);
|
);
|
||||||
|
|
||||||
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
|
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
|
||||||
// BLTOUCH needs to be stowed after trigger to rearm itself
|
if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE)
|
||||||
if (axis == Z_AXIS) bltouch.stow();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// When homing Z with probe respect probe clearance
|
// When homing Z with probe respect probe clearance
|
||||||
|
@ -1461,16 +1459,14 @@ void homeaxis(const AxisEnum axis) {
|
||||||
// Slow move towards endstop until triggered
|
// Slow move towards endstop until triggered
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 2 Slow:");
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 2 Slow:");
|
||||||
|
|
||||||
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
|
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
|
||||||
// BLTOUCH needs to be deployed every time
|
if (axis == Z_AXIS && bltouch.deploy()) return; // Intermediate DEPLOY (in LOW SPEED MODE)
|
||||||
if (axis == Z_AXIS && bltouch.deploy()) return;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis));
|
do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis));
|
||||||
|
|
||||||
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
|
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
|
||||||
// BLTOUCH needs to be stowed after trigger to rearm itself
|
if (axis == Z_AXIS) bltouch.stow(); // The final STOW
|
||||||
if (axis == Z_AXIS) bltouch.stow();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -356,9 +356,15 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
||||||
|
|
||||||
dock_sled(!deploy);
|
dock_sled(!deploy);
|
||||||
|
|
||||||
#elif HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH)
|
#elif HAS_Z_SERVO_PROBE
|
||||||
|
|
||||||
|
#if DISABLED(BLTOUCH)
|
||||||
MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);
|
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)
|
#elif ENABLED(Z_PROBE_ALLEN_KEY)
|
||||||
|
|
||||||
|
@ -492,9 +498,8 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Deploy BLTouch at the start of any probe
|
#if ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
|
||||||
#if ENABLED(BLTOUCH)
|
if (bltouch.deploy()) return true; // DEPLOY in LOW SPEED MODE on every probe action
|
||||||
if (bltouch.deploy()) return true;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disable stealthChop if used. Enable diag1 pin on driver.
|
// 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);
|
tmc_disable_stallguard(stepperZ, stealth_states.z);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Retract BLTouch immediately after a probe if it was triggered
|
#if ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
|
||||||
#if ENABLED(BLTOUCH)
|
if (probe_triggered && bltouch.stow()) return true; // STOW in LOW SPEED MODE on trigger on every probe action
|
||||||
if (probe_triggered && bltouch.stow()) return true;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clear endstop flags
|
// Clear endstop flags
|
||||||
|
|
Loading…
Reference in a new issue