Add TMC2130 sensorless probing

This commit is contained in:
Thomas Moore 2018-09-09 15:59:12 -04:00 committed by Scott Lahteine
parent 7d5c336c56
commit 3286325044
16 changed files with 149 additions and 85 deletions

View file

@ -1258,11 +1258,11 @@
#define E5_HYBRID_THRESHOLD 30 #define E5_HYBRID_THRESHOLD 30
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use StallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin.
* X, Y, and Z homing will always be done in spreadCycle mode. * X, Y, and Z homing will always be done in spreadCycle mode.
* *
* X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
* Lower value make the system MORE sensitive. * Lower value make the system MORE sensitive.
* Too low values can lead to false positives, while too high values will collide the axis without triggering. * Too low values can lead to false positives, while too high values will collide the axis without triggering.
@ -1271,10 +1271,18 @@
*/ */
//#define SENSORLESS_HOMING // TMC2130 only //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) /**
#define X_HOMING_SENSITIVITY 8 * Use StallGuard2 to probe the bed with the nozzle.
#define Y_HOMING_SENSITIVITY 8 *
//#define Z_HOMING_SENSITIVITY 8 * CAUTION: This could cause damage to machines that use a lead screw or threaded rod
* to move the Z axis. Take extreme care when attempting to enable this feature.
*/
//#define SENSORLESS_PROBING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING)
#define X_STALL_SENSITIVITY 8
#define Y_STALL_SENSITIVITY 8
//#define Z_STALL_SENSITIVITY 8
#endif #endif
/** /**

View file

@ -1258,11 +1258,11 @@
#define E5_HYBRID_THRESHOLD 30 #define E5_HYBRID_THRESHOLD 30
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use StallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin.
* X, Y, and Z homing will always be done in spreadCycle mode. * X, Y, and Z homing will always be done in spreadCycle mode.
* *
* X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
* Lower value make the system MORE sensitive. * Lower value make the system MORE sensitive.
* Too low values can lead to false positives, while too high values will collide the axis without triggering. * Too low values can lead to false positives, while too high values will collide the axis without triggering.
@ -1271,10 +1271,18 @@
*/ */
//#define SENSORLESS_HOMING // TMC2130 only //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) /**
#define X_HOMING_SENSITIVITY 8 * Use StallGuard2 to probe the bed with the nozzle.
#define Y_HOMING_SENSITIVITY 8 *
//#define Z_HOMING_SENSITIVITY 8 * CAUTION: This could cause damage to machines that use a lead screw or threaded rod
* to move the Z axis. Take extreme care when attempting to enable this feature.
*/
//#define SENSORLESS_PROBING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING)
#define X_STALL_SENSITIVITY 8
#define Y_STALL_SENSITIVITY 8
//#define Z_STALL_SENSITIVITY 8
#endif #endif
/** /**

View file

@ -663,9 +663,9 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
#endif // TMC_DEBUG #endif // TMC_DEBUG
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
void tmc_sensorless_homing(TMC2130Stepper &st, const bool enable/*=true*/) { void tmc_stallguard(TMC2130Stepper &st, const bool enable/*=true*/) {
st.coolstep_min_speed(enable ? 1024UL * 1024UL - 1UL : 0); st.coolstep_min_speed(enable ? 1024UL * 1024UL - 1UL : 0);
#if ENABLED(STEALTHCHOP) #if ENABLED(STEALTHCHOP)
st.stealthChop(!enable); st.stealthChop(!enable);
@ -673,7 +673,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
st.diag1_stall(enable ? 1 : 0); st.diag1_stall(enable ? 1 : 0);
} }
#endif // SENSORLESS_HOMING #endif // USE_SENSORLESS
#if HAS_DRIVER(TMC2130) #if HAS_DRIVER(TMC2130)
#define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH) #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)

View file

@ -128,8 +128,8 @@ void monitor_tmc_driver();
* *
* Defined here because of limitations with templates and headers. * Defined here because of limitations with templates and headers.
*/ */
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
void tmc_sensorless_homing(TMC2130Stepper &st, const bool enable=true); void tmc_stallguard(TMC2130Stepper &st, const bool enable=true);
#endif #endif
#if HAS_DRIVER(TMC2130) #if HAS_DRIVER(TMC2130)

View file

@ -267,9 +267,9 @@ void GcodeSuite::M912() {
#endif // HYBRID_THRESHOLD #endif // HYBRID_THRESHOLD
/** /**
* M914: Set SENSORLESS_HOMING sensitivity. * M914: Set StallGuard sensitivity.
*/ */
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
void GcodeSuite::M914() { void GcodeSuite::M914() {
#define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q, TMC_##Q) #define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q, TMC_##Q)
#define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, value) #define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, value)
@ -346,7 +346,7 @@ void GcodeSuite::M912() {
#endif #endif
} }
} }
#endif // SENSORLESS_HOMING #endif // USE_SENSORLESS
/** /**
* TMC Z axis calibration routine * TMC Z axis calibration routine

View file

@ -637,8 +637,8 @@ void GcodeSuite::process_parsed_command(
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
case 913: M913(); break; // M913: Set HYBRID_THRESHOLD speed. case 913: M913(); break; // M913: Set HYBRID_THRESHOLD speed.
#endif #endif
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
case 914: M914(); break; // M914: Set SENSORLESS_HOMING sensitivity. case 914: M914(); break; // M914: Set StallGuard sensitivity.
#endif #endif
#if ENABLED(TMC_Z_CALIBRATION) #if ENABLED(TMC_Z_CALIBRATION)
case 915: M915(); break; // M915: TMC Z axis calibration. case 915: M915(); break; // M915: TMC Z axis calibration.

View file

@ -229,7 +229,7 @@
* M911 - Report stepper driver overtemperature pre-warn condition. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660) * M911 - Report stepper driver overtemperature pre-warn condition. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
* M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660) * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
* M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD) * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
* M914 - Set SENSORLESS_HOMING sensitivity. (Requires SENSORLESS_HOMING) * M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING)
* *
* M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration) * M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
* M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree) * M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
@ -780,7 +780,7 @@ private:
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
static void M913(); static void M913();
#endif #endif
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
static void M914(); static void M914();
#endif #endif
#if ENABLED(TMC_Z_CALIBRATION) #if ENABLED(TMC_Z_CALIBRATION)

View file

@ -528,7 +528,7 @@
/** /**
* Set flags for enabled probes * Set flags for enabled probes
*/ */
#define HAS_BED_PROBE (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_PROBE || ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE)) #define HAS_BED_PROBE (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_PROBE || ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE) || ENABLED(SENSORLESS_PROBING))
#define PROBE_SELECTED (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING)) #define PROBE_SELECTED (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING))
#if !HAS_BED_PROBE #if !HAS_BED_PROBE

View file

@ -869,14 +869,15 @@
#define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) ) #define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
#define AXIS_HAS_STALLGUARD(ST) AXIS_DRIVER_TYPE(ST, TMC2130) #define AXIS_HAS_STALLGUARD(ST) AXIS_DRIVER_TYPE(ST, TMC2130)
#if ENABLED(SENSORLESS_HOMING) #define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING))
#if USE_SENSORLESS
// Disable Z axis sensorless homing if a probe is used to home the Z axis // Disable Z axis sensorless homing if a probe is used to home the Z axis
#if HOMING_Z_WITH_PROBE #if HOMING_Z_WITH_PROBE
#undef Z_HOMING_SENSITIVITY #undef Z_STALL_SENSITIVITY
#endif #endif
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_HOMING_SENSITIVITY)) #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY))
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_HOMING_SENSITIVITY)) #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY))
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_HOMING_SENSITIVITY)) #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY))
#endif #endif
// Endstops and bed probe // Endstops and bed probe

View file

@ -895,7 +895,13 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
/** /**
* Require pin options and pins to be defined * Require pin options and pins to be defined
*/ */
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #if ENABLED(SENSORLESS_PROBING)
#if ENABLED(DELTA) && (!AXIS_DRIVER_TYPE_X(TMC2130) || !AXIS_DRIVER_TYPE_Y(TMC2130) || !AXIS_DRIVER_TYPE_Z(TMC2130))
#error "SENSORLESS_PROBING requires TMC2130 drivers on X, Y, and Z."
#elif !AXIS_DRIVER_TYPE_Z(TMC2130)
#error "SENSORLESS_PROBING requires a TMC2130 driver on Z."
#endif
#elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#if ENABLED(Z_MIN_PROBE_ENDSTOP) #if ENABLED(Z_MIN_PROBE_ENDSTOP)
#error "Enable only one option: Z_MIN_PROBE_ENDSTOP or Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN." #error "Enable only one option: Z_MIN_PROBE_ENDSTOP or Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN."
#elif DISABLED(USE_ZMIN_PLUG) #elif DISABLED(USE_ZMIN_PLUG)
@ -1746,19 +1752,18 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#error "CoreYZ requires both Y and Z to use sensorless homing if either does." #error "CoreYZ requires both Y and Z to use sensorless homing if either does."
#endif #endif
// Other TMC feature requirements
#if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP) #if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
#error "Enable STEALTHCHOP to use HYBRID_THRESHOLD." #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
#endif #elif ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2) && !AXIS_IS_TMC(Z3)
#if ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2) && !AXIS_IS_TMC(Z3)
#error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis" #error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis"
#endif #elif ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD
#error "SENSORLESS_HOMING requires TMC2130 stepper drivers."
#if ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD #elif ENABLED(SENSORLESS_PROBING) && !HAS_STALLGUARD
#error "SENSORLESS_HOMING requires TMC2130 or TMC2660 stepper drivers." #error "SENSORLESS_PROBING requires TMC2130 stepper drivers."
#endif #elif ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP
#if ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP
#error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers." #error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers."
#endif #endif
/** /**
* Digipot requirement * Digipot requirement

View file

@ -920,10 +920,10 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(tmc_hybrid_threshold); EEPROM_WRITE(tmc_hybrid_threshold);
// //
// TMC2130 Sensorless homing threshold // TMC2130 StallGuard threshold
// //
int16_t tmc_sgt[XYZ] = { int16_t tmc_sgt[XYZ] = {
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
#if X_SENSORLESS #if X_SENSORLESS
stepperX.sgt(), stepperX.sgt(),
#else #else
@ -1530,16 +1530,16 @@ void MarlinSettings::postprocess() {
#endif #endif
/* /*
* TMC2130 Sensorless homing threshold. * TMC2130 StallGuard threshold.
* X and X2 use the same value * X and X2 use the same value
* Y and Y2 use the same value * Y and Y2 use the same value
* Z, Z2 and Z3 use the same value * Z, Z2 and Z3 use the same value
*/ */
int16_t tmc_sgt[XYZ]; int16_t tmc_sgt[XYZ];
EEPROM_READ(tmc_sgt); EEPROM_READ(tmc_sgt);
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
if (!validating) { if (!validating) {
#ifdef X_HOMING_SENSITIVITY #ifdef X_STALL_SENSITIVITY
#if AXIS_HAS_STALLGUARD(X) #if AXIS_HAS_STALLGUARD(X)
stepperX.sgt(tmc_sgt[0]); stepperX.sgt(tmc_sgt[0]);
#endif #endif
@ -1547,7 +1547,7 @@ void MarlinSettings::postprocess() {
stepperX2.sgt(tmc_sgt[0]); stepperX2.sgt(tmc_sgt[0]);
#endif #endif
#endif #endif
#ifdef Y_HOMING_SENSITIVITY #ifdef Y_STALL_SENSITIVITY
#if AXIS_HAS_STALLGUARD(Y) #if AXIS_HAS_STALLGUARD(Y)
stepperY.sgt(tmc_sgt[1]); stepperY.sgt(tmc_sgt[1]);
#endif #endif
@ -1555,7 +1555,7 @@ void MarlinSettings::postprocess() {
stepperY2.sgt(tmc_sgt[1]); stepperY2.sgt(tmc_sgt[1]);
#endif #endif
#endif #endif
#ifdef Z_HOMING_SENSITIVITY #ifdef Z_STALL_SENSITIVITY
#if AXIS_HAS_STALLGUARD(Z) #if AXIS_HAS_STALLGUARD(Z)
stepperZ.sgt(tmc_sgt[2]); stepperZ.sgt(tmc_sgt[2]);
#endif #endif
@ -2120,7 +2120,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M913"); } void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M913"); }
#endif #endif
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
void say_M914(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M914"); } void say_M914(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M914"); }
#endif #endif
#endif #endif
@ -2824,12 +2824,12 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif // HYBRID_THRESHOLD #endif // HYBRID_THRESHOLD
/** /**
* TMC2130 Sensorless homing thresholds * TMC2130 Sensorless homing thresholds
*/ */
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
if (!forReplay) { if (!forReplay) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:"); SERIAL_ECHOLNPGM_P(port, "TMC2130 StallGuard threshold:");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
#if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS #if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
@ -2846,10 +2846,10 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#endif #endif
#define HAS_X2_SENSORLESS (defined(X_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2)) #define HAS_X2_SENSORLESS (defined(X_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2))
#define HAS_Y2_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)) #define HAS_Y2_SENSORLESS (defined(Y_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2))
#define HAS_Z2_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)) #define HAS_Z2_SENSORLESS (defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2))
#define HAS_Z3_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)) #define HAS_Z3_SENSORLESS (defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3))
#if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS #if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS
say_M914(PORTVAR_SOLO); say_M914(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I1"); SERIAL_ECHOPGM_P(port, " I1");
@ -2871,7 +2871,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_ECHOLNPAIR_P(port, " Z", stepperZ3.sgt()); SERIAL_ECHOLNPAIR_P(port, " Z", stepperZ3.sgt());
#endif #endif
#endif // SENSORLESS_HOMING #endif // USE_SENSORLESS
#endif // HAS_TRINAMIC #endif // HAS_TRINAMIC

View file

@ -981,31 +981,31 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
default: break; default: break;
#if X_SENSORLESS #if X_SENSORLESS
case X_AXIS: case X_AXIS:
tmc_sensorless_homing(stepperX, enable); tmc_stallguard(stepperX, enable);
#if CORE_IS_XY && Y_SENSORLESS #if CORE_IS_XY && Y_SENSORLESS
tmc_sensorless_homing(stepperY, enable); tmc_stallguard(stepperY, enable);
#elif CORE_IS_XZ && Z_SENSORLESS #elif CORE_IS_XZ && Z_SENSORLESS
tmc_sensorless_homing(stepperZ, enable); tmc_stallguard(stepperZ, enable);
#endif #endif
break; break;
#endif #endif
#if Y_SENSORLESS #if Y_SENSORLESS
case Y_AXIS: case Y_AXIS:
tmc_sensorless_homing(stepperY, enable); tmc_stallguard(stepperY, enable);
#if CORE_IS_XY && X_SENSORLESS #if CORE_IS_XY && X_SENSORLESS
tmc_sensorless_homing(stepperX, enable); tmc_stallguard(stepperX, enable);
#elif CORE_IS_YZ && Z_SENSORLESS #elif CORE_IS_YZ && Z_SENSORLESS
tmc_sensorless_homing(stepperZ, enable); tmc_stallguard(stepperZ, enable);
#endif #endif
break; break;
#endif #endif
#if Z_SENSORLESS #if Z_SENSORLESS
case Z_AXIS: case Z_AXIS:
tmc_sensorless_homing(stepperZ, enable); tmc_stallguard(stepperZ, enable);
#if CORE_IS_XZ && X_SENSORLESS #if CORE_IS_XZ && X_SENSORLESS
tmc_sensorless_homing(stepperX, enable); tmc_stallguard(stepperX, enable);
#elif CORE_IS_YZ && Y_SENSORLESS #elif CORE_IS_YZ && Y_SENSORLESS
tmc_sensorless_homing(stepperY, enable); tmc_stallguard(stepperY, enable);
#endif #endif
break; break;
#endif #endif

View file

@ -58,6 +58,11 @@ float zprobe_zoffset; // Initialized by settings.load()
#include "../module/servo.h" #include "../module/servo.h"
#endif #endif
#if ENABLED(SENSORLESS_PROBING)
#include "stepper.h"
#include "../feature/tmc_util.h"
#endif
#if ENABLED(Z_PROBE_SLED) #if ENABLED(Z_PROBE_SLED)
#ifndef SLED_DOCKING_OFFSET #ifndef SLED_DOCKING_OFFSET
@ -527,31 +532,58 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
if (set_bltouch_deployed(true)) return true; if (set_bltouch_deployed(true)) return true;
#endif #endif
// Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_PROBING)
#if ENABLED(DELTA)
tmc_stallguard(stepperX);
tmc_stallguard(stepperY);
#endif
tmc_stallguard(stepperZ);
#endif
#if QUIET_PROBING #if QUIET_PROBING
probing_pause(true); probing_pause(true);
#endif #endif
endstops.enable(true);
// Move down until probe triggered // Move down until probe triggered
do_blocking_move_to_z(z, fr_mm_s); do_blocking_move_to_z(z, fr_mm_s);
// Check to see if the probe was triggered // Check to see if the probe was triggered
const bool probe_triggered = TEST(endstops.trigger_state(), const bool probe_triggered =
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #if ENABLED(DELTA) && ENABLED(SENSORLESS_PROBING)
Z_MIN endstops.trigger_state() & (_BV(X_MIN) | _BV(Y_MIN) | _BV(Z_MIN))
#else #else
Z_MIN_PROBE TEST(endstops.trigger_state(),
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
Z_MIN
#else
Z_MIN_PROBE
#endif
)
#endif #endif
); ;
#if QUIET_PROBING #if QUIET_PROBING
probing_pause(false); probing_pause(false);
#endif #endif
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_PROBING)
#if ENABLED(DELTA)
tmc_stallguard(stepperX, false);
tmc_stallguard(stepperY, false);
#endif
tmc_stallguard(stepperZ, false);
#endif
// Retract BLTouch immediately after a probe if it was triggered // Retract BLTouch immediately after a probe if it was triggered
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
if (probe_triggered && set_bltouch_deployed(false)) return true; if (probe_triggered && set_bltouch_deployed(false)) return true;
#endif #endif
// Clear endstop flags
endstops.hit_on_purpose(); endstops.hit_on_purpose();
// Get Z where the steppers were interrupted // Get Z where the steppers were interrupted
@ -606,13 +638,11 @@ static float run_z_probe() {
// move up to make clearance for the probe // move up to make clearance for the probe
do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
#else #elif Z_PROBE_SPEED_FAST != Z_PROBE_SPEED_SLOW
// If the nozzle is well over the travel height then // If the nozzle is well over the travel height then
// move down quickly before doing the slow probe // move down quickly before doing the slow probe
float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0; const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (zprobe_zoffset < 0 ? -zprobe_zoffset : 0);
if (zprobe_zoffset < 0) z -= zprobe_zoffset;
if (current_position[Z_AXIS] > z) { if (current_position[Z_AXIS] > z) {
// If we don't make it to the z position (i.e. the probe triggered), move up to make clearance for the probe // If we don't make it to the z position (i.e. the probe triggered), move up to make clearance for the probe
if (!do_probe_move(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) if (!do_probe_move(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))

View file

@ -273,33 +273,33 @@
{ constexpr uint8_t extruder = 5; _TMC2130_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); } { constexpr uint8_t extruder = 5; _TMC2130_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
#endif #endif
#if ENABLED(SENSORLESS_HOMING) #if USE_SENSORLESS
#define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_HOMING_SENSITIVITY); #define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_STALL_SENSITIVITY);
#if X_SENSORLESS #if X_SENSORLESS
#if AXIS_DRIVER_TYPE(X, TMC2130) #if AXIS_DRIVER_TYPE(X, TMC2130)
stepperX.sgt(X_HOMING_SENSITIVITY); stepperX.sgt(X_STALL_SENSITIVITY);
#endif #endif
#if AXIS_DRIVER_TYPE(X2, TMC2130) #if AXIS_DRIVER_TYPE(X2, TMC2130)
stepperX2.sgt(X_HOMING_SENSITIVITY); stepperX2.sgt(X_STALL_SENSITIVITY);
#endif #endif
#endif #endif
#if Y_SENSORLESS #if Y_SENSORLESS
#if AXIS_DRIVER_TYPE(Y, TMC2130) #if AXIS_DRIVER_TYPE(Y, TMC2130)
stepperY.sgt(Y_HOMING_SENSITIVITY); stepperY.sgt(Y_STALL_SENSITIVITY);
#endif #endif
#if AXIS_DRIVER_TYPE(Y2, TMC2130) #if AXIS_DRIVER_TYPE(Y2, TMC2130)
stepperY2.sgt(Y_HOMING_SENSITIVITY); stepperY2.sgt(Y_STALL_SENSITIVITY);
#endif #endif
#endif #endif
#if Z_SENSORLESS #if Z_SENSORLESS
#if AXIS_DRIVER_TYPE(Z, TMC2130) #if AXIS_DRIVER_TYPE(Z, TMC2130)
stepperZ.sgt(Z_HOMING_SENSITIVITY); stepperZ.sgt(Z_STALL_SENSITIVITY);
#endif #endif
#if AXIS_DRIVER_TYPE(Z2, TMC2130) #if AXIS_DRIVER_TYPE(Z2, TMC2130)
stepperZ2.sgt(Z_HOMING_SENSITIVITY); stepperZ2.sgt(Z_STALL_SENSITIVITY);
#endif #endif
#if ENABLED(Z3_IS_TMC2130) #if ENABLED(Z3_IS_TMC2130)
stepperZ3.sgt(Z_HOMING_SENSITIVITY); stepperZ3.sgt(Z_STALL_SENSITIVITY);
#endif #endif
#endif #endif
#endif #endif

View file

@ -60,5 +60,16 @@ opt_enable FAN_SOFT_PWM SDSUPPORT
opt_enable USE_XMAX_PLUG opt_enable USE_XMAX_PLUG
exec_test $1 $2 "MKS SBASE Many less common options" exec_test $1 $2 "MKS SBASE Many less common options"
restore_configs
use_example_configs delta/generic
opt_set MOTHERBOARD BOARD_COHESION3D_REMIX
opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 EEPROM_SETTINGS EEPROM_CHITCHAT
opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
opt_set X_DRIVER_TYPE TMC2130
opt_set Y_DRIVER_TYPE TMC2130
opt_set Z_DRIVER_TYPE TMC2130
opt_enable_adv TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG SENSORLESS_PROBING
exec_test $1 $2 "Delta Config (generic) + BOARD_COHESION3D_REMIX + UBL + EEPROM_SETTINGS + SENSORLESS_PROBING"
#clean up #clean up
restore_configs restore_configs

View file

@ -296,6 +296,7 @@ opt_set X_DRIVER_TYPE TMC2208
opt_set Y_DRIVER_TYPE TMC2208 opt_set Y_DRIVER_TYPE TMC2208
opt_set Z_DRIVER_TYPE TMC2208 opt_set Z_DRIVER_TYPE TMC2208
opt_set E0_DRIVER_TYPE TMC2208 opt_set E0_DRIVER_TYPE TMC2208
opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG
exec_test $1 $2 "TMC2208 Config" exec_test $1 $2 "TMC2208 Config"
# #