Просмотр исходного кода

Add TMC2130 sensorless probing

Thomas Moore 5 лет назад
Родитель
Сommit
3286325044

+ 15
- 7
Marlin/Configuration_adv.h Просмотреть файл

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

+ 15
- 7
Marlin/src/config/default/Configuration_adv.h Просмотреть файл

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

+ 3
- 3
Marlin/src/feature/tmc_util.cpp Просмотреть файл

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

+ 2
- 2
Marlin/src/feature/tmc_util.h Просмотреть файл

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

+ 3
- 3
Marlin/src/gcode/feature/trinamic/M911-M915.cpp Просмотреть файл

@@ -267,9 +267,9 @@ void GcodeSuite::M912() {
267 267
 #endif // HYBRID_THRESHOLD
268 268
 
269 269
 /**
270
- * M914: Set SENSORLESS_HOMING sensitivity.
270
+ * M914: Set StallGuard sensitivity.
271 271
  */
272
-#if ENABLED(SENSORLESS_HOMING)
272
+#if USE_SENSORLESS
273 273
   void GcodeSuite::M914() {
274 274
     #define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q, TMC_##Q)
275 275
     #define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, value)
@@ -346,7 +346,7 @@ void GcodeSuite::M912() {
346 346
       #endif
347 347
     }
348 348
   }
349
-#endif // SENSORLESS_HOMING
349
+#endif // USE_SENSORLESS
350 350
 
351 351
 /**
352 352
  * TMC Z axis calibration routine

+ 2
- 2
Marlin/src/gcode/gcode.cpp Просмотреть файл

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

+ 2
- 2
Marlin/src/gcode/gcode.h Просмотреть файл

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

+ 1
- 1
Marlin/src/inc/Conditionals_LCD.h Просмотреть файл

@@ -528,7 +528,7 @@
528 528
 /**
529 529
  * Set flags for enabled probes
530 530
  */
531
-#define HAS_BED_PROBE (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_PROBE || ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE))
531
+#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))
532 532
 #define PROBE_SELECTED (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING))
533 533
 
534 534
 #if !HAS_BED_PROBE

+ 6
- 5
Marlin/src/inc/Conditionals_post.h Просмотреть файл

@@ -869,14 +869,15 @@
869 869
 #define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
870 870
 #define AXIS_HAS_STALLGUARD(ST) AXIS_DRIVER_TYPE(ST, TMC2130)
871 871
 
872
-#if ENABLED(SENSORLESS_HOMING)
872
+#define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING))
873
+#if USE_SENSORLESS
873 874
   // Disable Z axis sensorless homing if a probe is used to home the Z axis
874 875
   #if HOMING_Z_WITH_PROBE
875
-    #undef Z_HOMING_SENSITIVITY
876
+    #undef Z_STALL_SENSITIVITY
876 877
   #endif
877
-  #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_HOMING_SENSITIVITY))
878
-  #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_HOMING_SENSITIVITY))
879
-  #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_HOMING_SENSITIVITY))
878
+  #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY))
879
+  #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY))
880
+  #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY))
880 881
 #endif
881 882
 
882 883
 // Endstops and bed probe

+ 15
- 10
Marlin/src/inc/SanityCheck.h Просмотреть файл

@@ -895,7 +895,13 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
895 895
   /**
896 896
    * Require pin options and pins to be defined
897 897
    */
898
-  #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
898
+  #if ENABLED(SENSORLESS_PROBING)
899
+    #if ENABLED(DELTA) && (!AXIS_DRIVER_TYPE_X(TMC2130) || !AXIS_DRIVER_TYPE_Y(TMC2130) || !AXIS_DRIVER_TYPE_Z(TMC2130))
900
+      #error "SENSORLESS_PROBING requires TMC2130 drivers on X, Y, and Z."
901
+    #elif !AXIS_DRIVER_TYPE_Z(TMC2130)
902
+      #error "SENSORLESS_PROBING requires a TMC2130 driver on Z."
903
+    #endif
904
+  #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
899 905
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
900 906
       #error "Enable only one option: Z_MIN_PROBE_ENDSTOP or Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN."
901 907
     #elif DISABLED(USE_ZMIN_PLUG)
@@ -1746,19 +1752,18 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
1746 1752
   #error "CoreYZ requires both Y and Z to use sensorless homing if either does."
1747 1753
 #endif
1748 1754
 
1755
+// Other TMC feature requirements
1749 1756
 #if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
1750 1757
   #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
1751
-#endif
1752
-#if ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2) && !AXIS_IS_TMC(Z3)
1758
+#elif ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2) && !AXIS_IS_TMC(Z3)
1753 1759
   #error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis"
1754
-#endif
1755
-
1756
-#if ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD
1757
-  #error "SENSORLESS_HOMING requires TMC2130 or TMC2660 stepper drivers."
1758
-#endif
1759
-#if ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP
1760
+#elif ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD
1761
+  #error "SENSORLESS_HOMING requires TMC2130 stepper drivers."
1762
+#elif ENABLED(SENSORLESS_PROBING) && !HAS_STALLGUARD
1763
+  #error "SENSORLESS_PROBING requires TMC2130 stepper drivers."
1764
+#elif ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP
1760 1765
   #error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers."
1761
- #endif
1766
+#endif
1762 1767
 
1763 1768
 /**
1764 1769
  * Digipot requirement

+ 16
- 16
Marlin/src/module/configuration_store.cpp Просмотреть файл

@@ -920,10 +920,10 @@ void MarlinSettings::postprocess() {
920 920
     EEPROM_WRITE(tmc_hybrid_threshold);
921 921
 
922 922
     //
923
-    // TMC2130 Sensorless homing threshold
923
+    // TMC2130 StallGuard threshold
924 924
     //
925 925
     int16_t tmc_sgt[XYZ] = {
926
-      #if ENABLED(SENSORLESS_HOMING)
926
+      #if USE_SENSORLESS
927 927
         #if X_SENSORLESS
928 928
           stepperX.sgt(),
929 929
         #else
@@ -1530,16 +1530,16 @@ void MarlinSettings::postprocess() {
1530 1530
       #endif
1531 1531
 
1532 1532
       /*
1533
-       * TMC2130 Sensorless homing threshold.
1533
+       * TMC2130 StallGuard threshold.
1534 1534
        * X and X2 use the same value
1535 1535
        * Y and Y2 use the same value
1536 1536
        * Z, Z2 and Z3 use the same value
1537 1537
        */
1538 1538
       int16_t tmc_sgt[XYZ];
1539 1539
       EEPROM_READ(tmc_sgt);
1540
-      #if ENABLED(SENSORLESS_HOMING)
1540
+      #if USE_SENSORLESS
1541 1541
         if (!validating) {
1542
-          #ifdef X_HOMING_SENSITIVITY
1542
+          #ifdef X_STALL_SENSITIVITY
1543 1543
             #if AXIS_HAS_STALLGUARD(X)
1544 1544
               stepperX.sgt(tmc_sgt[0]);
1545 1545
             #endif
@@ -1547,7 +1547,7 @@ void MarlinSettings::postprocess() {
1547 1547
               stepperX2.sgt(tmc_sgt[0]);
1548 1548
             #endif
1549 1549
           #endif
1550
-          #ifdef Y_HOMING_SENSITIVITY
1550
+          #ifdef Y_STALL_SENSITIVITY
1551 1551
             #if AXIS_HAS_STALLGUARD(Y)
1552 1552
               stepperY.sgt(tmc_sgt[1]);
1553 1553
             #endif
@@ -1555,7 +1555,7 @@ void MarlinSettings::postprocess() {
1555 1555
               stepperY2.sgt(tmc_sgt[1]);
1556 1556
             #endif
1557 1557
           #endif
1558
-          #ifdef Z_HOMING_SENSITIVITY
1558
+          #ifdef Z_STALL_SENSITIVITY
1559 1559
             #if AXIS_HAS_STALLGUARD(Z)
1560 1560
               stepperZ.sgt(tmc_sgt[2]);
1561 1561
             #endif
@@ -2120,7 +2120,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2120 2120
     #if ENABLED(HYBRID_THRESHOLD)
2121 2121
       void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M913"); }
2122 2122
     #endif
2123
-    #if ENABLED(SENSORLESS_HOMING)
2123
+    #if USE_SENSORLESS
2124 2124
       void say_M914(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M914"); }
2125 2125
     #endif
2126 2126
   #endif
@@ -2824,12 +2824,12 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2824 2824
       #endif // HYBRID_THRESHOLD
2825 2825
 
2826 2826
       /**
2827
-       * TMC2130 Sensorless homing thresholds
2827
+     * TMC2130 Sensorless homing thresholds
2828 2828
        */
2829
-      #if ENABLED(SENSORLESS_HOMING)
2829
+      #if USE_SENSORLESS
2830 2830
         if (!forReplay) {
2831 2831
           CONFIG_ECHO_START;
2832
-          SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:");
2832
+          SERIAL_ECHOLNPGM_P(port, "TMC2130 StallGuard threshold:");
2833 2833
         }
2834 2834
         CONFIG_ECHO_START;
2835 2835
         #if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
@@ -2846,10 +2846,10 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2846 2846
           SERIAL_EOL_P(port);
2847 2847
         #endif
2848 2848
 
2849
-        #define HAS_X2_SENSORLESS (defined(X_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2))
2850
-        #define HAS_Y2_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2))
2851
-        #define HAS_Z2_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2))
2852
-        #define HAS_Z3_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3))
2849
+        #define HAS_X2_SENSORLESS (defined(X_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2))
2850
+        #define HAS_Y2_SENSORLESS (defined(Y_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2))
2851
+        #define HAS_Z2_SENSORLESS (defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2))
2852
+        #define HAS_Z3_SENSORLESS (defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3))
2853 2853
         #if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS
2854 2854
           say_M914(PORTVAR_SOLO);
2855 2855
           SERIAL_ECHOPGM_P(port, " I1");
@@ -2871,7 +2871,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2871 2871
           SERIAL_ECHOLNPAIR_P(port, " Z", stepperZ3.sgt());
2872 2872
         #endif
2873 2873
 
2874
-      #endif // SENSORLESS_HOMING
2874
+      #endif // USE_SENSORLESS
2875 2875
 
2876 2876
     #endif // HAS_TRINAMIC
2877 2877
 

+ 9
- 9
Marlin/src/module/motion.cpp Просмотреть файл

@@ -981,31 +981,31 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
981 981
       default: break;
982 982
       #if X_SENSORLESS
983 983
         case X_AXIS:
984
-          tmc_sensorless_homing(stepperX, enable);
984
+          tmc_stallguard(stepperX, enable);
985 985
           #if CORE_IS_XY && Y_SENSORLESS
986
-            tmc_sensorless_homing(stepperY, enable);
986
+            tmc_stallguard(stepperY, enable);
987 987
           #elif CORE_IS_XZ && Z_SENSORLESS
988
-            tmc_sensorless_homing(stepperZ, enable);
988
+            tmc_stallguard(stepperZ, enable);
989 989
           #endif
990 990
           break;
991 991
       #endif
992 992
       #if Y_SENSORLESS
993 993
         case Y_AXIS:
994
-          tmc_sensorless_homing(stepperY, enable);
994
+          tmc_stallguard(stepperY, enable);
995 995
           #if CORE_IS_XY && X_SENSORLESS
996
-            tmc_sensorless_homing(stepperX, enable);
996
+            tmc_stallguard(stepperX, enable);
997 997
           #elif CORE_IS_YZ && Z_SENSORLESS
998
-            tmc_sensorless_homing(stepperZ, enable);
998
+            tmc_stallguard(stepperZ, enable);
999 999
           #endif
1000 1000
           break;
1001 1001
       #endif
1002 1002
       #if Z_SENSORLESS
1003 1003
         case Z_AXIS:
1004
-          tmc_sensorless_homing(stepperZ, enable);
1004
+          tmc_stallguard(stepperZ, enable);
1005 1005
           #if CORE_IS_XZ && X_SENSORLESS
1006
-            tmc_sensorless_homing(stepperX, enable);
1006
+            tmc_stallguard(stepperX, enable);
1007 1007
           #elif CORE_IS_YZ && Y_SENSORLESS
1008
-            tmc_sensorless_homing(stepperY, enable);
1008
+            tmc_stallguard(stepperY, enable);
1009 1009
           #endif
1010 1010
           break;
1011 1011
       #endif

+ 39
- 9
Marlin/src/module/probe.cpp Просмотреть файл

@@ -58,6 +58,11 @@ float zprobe_zoffset; // Initialized by settings.load()
58 58
   #include "../module/servo.h"
59 59
 #endif
60 60
 
61
+#if ENABLED(SENSORLESS_PROBING)
62
+  #include "stepper.h"
63
+  #include "../feature/tmc_util.h"
64
+#endif
65
+
61 66
 #if ENABLED(Z_PROBE_SLED)
62 67
 
63 68
   #ifndef SLED_DOCKING_OFFSET
@@ -527,31 +532,58 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
527 532
     if (set_bltouch_deployed(true)) return true;
528 533
   #endif
529 534
 
535
+  // Disable stealthChop if used. Enable diag1 pin on driver.
536
+  #if ENABLED(SENSORLESS_PROBING)
537
+    #if ENABLED(DELTA)
538
+      tmc_stallguard(stepperX);
539
+      tmc_stallguard(stepperY);
540
+    #endif
541
+    tmc_stallguard(stepperZ);
542
+  #endif
543
+
530 544
   #if QUIET_PROBING
531 545
     probing_pause(true);
532 546
   #endif
533 547
 
548
+  endstops.enable(true);
549
+
534 550
   // Move down until probe triggered
535 551
   do_blocking_move_to_z(z, fr_mm_s);
536 552
 
537 553
   // Check to see if the probe was triggered
538
-  const bool probe_triggered = TEST(endstops.trigger_state(),
539
-    #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
540
-      Z_MIN
554
+  const bool probe_triggered = 
555
+    #if ENABLED(DELTA) && ENABLED(SENSORLESS_PROBING)
556
+      endstops.trigger_state() & (_BV(X_MIN) | _BV(Y_MIN) | _BV(Z_MIN))
541 557
     #else
542
-      Z_MIN_PROBE
558
+      TEST(endstops.trigger_state(),
559
+        #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
560
+          Z_MIN
561
+        #else
562
+          Z_MIN_PROBE
563
+        #endif
564
+      )
543 565
     #endif
544
-  );
566
+  ;
545 567
 
546 568
   #if QUIET_PROBING
547 569
     probing_pause(false);
548 570
   #endif
549 571
 
572
+  // Re-enable stealthChop if used. Disable diag1 pin on driver.
573
+  #if ENABLED(SENSORLESS_PROBING)
574
+    #if ENABLED(DELTA)
575
+      tmc_stallguard(stepperX, false);
576
+      tmc_stallguard(stepperY, false);
577
+    #endif
578
+    tmc_stallguard(stepperZ, false);
579
+  #endif
580
+
550 581
   // Retract BLTouch immediately after a probe if it was triggered
551 582
   #if ENABLED(BLTOUCH)
552 583
     if (probe_triggered && set_bltouch_deployed(false)) return true;
553 584
   #endif
554 585
 
586
+  // Clear endstop flags
555 587
   endstops.hit_on_purpose();
556 588
 
557 589
   // Get Z where the steppers were interrupted
@@ -606,13 +638,11 @@ static float run_z_probe() {
606 638
     // move up to make clearance for the probe
607 639
     do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
608 640
 
609
-  #else
641
+  #elif Z_PROBE_SPEED_FAST != Z_PROBE_SPEED_SLOW
610 642
 
611 643
     // If the nozzle is well over the travel height then
612 644
     // move down quickly before doing the slow probe
613
-    float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0;
614
-    if (zprobe_zoffset < 0) z -= zprobe_zoffset;
615
-
645
+    const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (zprobe_zoffset < 0 ? -zprobe_zoffset : 0);
616 646
     if (current_position[Z_AXIS] > z) {
617 647
       // If we don't make it to the z position (i.e. the probe triggered), move up to make clearance for the probe
618 648
       if (!do_probe_move(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))

+ 9
- 9
Marlin/src/module/stepper_indirection.cpp Просмотреть файл

@@ -273,33 +273,33 @@
273 273
       { constexpr uint8_t extruder = 5; _TMC2130_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
274 274
     #endif
275 275
 
276
-    #if ENABLED(SENSORLESS_HOMING)
277
-      #define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_HOMING_SENSITIVITY);
276
+    #if USE_SENSORLESS
277
+      #define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_STALL_SENSITIVITY);
278 278
       #if X_SENSORLESS
279 279
         #if AXIS_DRIVER_TYPE(X, TMC2130)
280
-          stepperX.sgt(X_HOMING_SENSITIVITY);
280
+          stepperX.sgt(X_STALL_SENSITIVITY);
281 281
         #endif
282 282
         #if AXIS_DRIVER_TYPE(X2, TMC2130)
283
-          stepperX2.sgt(X_HOMING_SENSITIVITY);
283
+          stepperX2.sgt(X_STALL_SENSITIVITY);
284 284
         #endif
285 285
       #endif
286 286
       #if Y_SENSORLESS
287 287
         #if AXIS_DRIVER_TYPE(Y, TMC2130)
288
-          stepperY.sgt(Y_HOMING_SENSITIVITY);
288
+          stepperY.sgt(Y_STALL_SENSITIVITY);
289 289
         #endif
290 290
         #if AXIS_DRIVER_TYPE(Y2, TMC2130)
291
-          stepperY2.sgt(Y_HOMING_SENSITIVITY);
291
+          stepperY2.sgt(Y_STALL_SENSITIVITY);
292 292
         #endif
293 293
       #endif
294 294
       #if Z_SENSORLESS
295 295
         #if AXIS_DRIVER_TYPE(Z, TMC2130)
296
-          stepperZ.sgt(Z_HOMING_SENSITIVITY);
296
+          stepperZ.sgt(Z_STALL_SENSITIVITY);
297 297
         #endif
298 298
         #if AXIS_DRIVER_TYPE(Z2, TMC2130)
299
-          stepperZ2.sgt(Z_HOMING_SENSITIVITY);
299
+          stepperZ2.sgt(Z_STALL_SENSITIVITY);
300 300
         #endif
301 301
         #if ENABLED(Z3_IS_TMC2130)
302
-          stepperZ3.sgt(Z_HOMING_SENSITIVITY);
302
+          stepperZ3.sgt(Z_STALL_SENSITIVITY);
303 303
         #endif
304 304
       #endif
305 305
     #endif

+ 11
- 0
buildroot/share/tests/LPC1768_tests Просмотреть файл

@@ -60,5 +60,16 @@ opt_enable FAN_SOFT_PWM SDSUPPORT
60 60
 opt_enable USE_XMAX_PLUG
61 61
 exec_test $1 $2 "MKS SBASE Many less common options"
62 62
 
63
+restore_configs
64
+use_example_configs delta/generic
65
+opt_set MOTHERBOARD BOARD_COHESION3D_REMIX
66
+opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 EEPROM_SETTINGS EEPROM_CHITCHAT
67
+opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
68
+opt_set X_DRIVER_TYPE TMC2130
69
+opt_set Y_DRIVER_TYPE TMC2130
70
+opt_set Z_DRIVER_TYPE TMC2130
71
+opt_enable_adv TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG SENSORLESS_PROBING
72
+exec_test $1 $2 "Delta Config (generic) + BOARD_COHESION3D_REMIX + UBL + EEPROM_SETTINGS + SENSORLESS_PROBING"
73
+
63 74
 #clean up
64 75
 restore_configs

+ 1
- 0
buildroot/share/tests/megaatmega2560_tests Просмотреть файл

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

Загрузка…
Отмена
Сохранить