Procházet zdrojové kódy

Add TMC2130 sensorless probing

Thomas Moore před 6 roky
rodič
revize
3286325044

+ 15
- 7
Marlin/Configuration_adv.h Zobrazit soubor

1258
   #define E5_HYBRID_THRESHOLD     30
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
    * X, Y, and Z homing will always be done in spreadCycle mode.
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
    * Higher values make the system LESS sensitive.
1266
    * Higher values make the system LESS sensitive.
1267
    * Lower value make the system MORE sensitive.
1267
    * Lower value make the system MORE sensitive.
1268
    * Too low values can lead to false positives, while too high values will collide the axis without triggering.
1268
    * Too low values can lead to false positives, while too high values will collide the axis without triggering.
1271
    */
1271
    */
1272
   //#define SENSORLESS_HOMING // TMC2130 only
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
   #endif
1286
   #endif
1279
 
1287
 
1280
   /**
1288
   /**

+ 15
- 7
Marlin/src/config/default/Configuration_adv.h Zobrazit soubor

1258
   #define E5_HYBRID_THRESHOLD     30
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
    * X, Y, and Z homing will always be done in spreadCycle mode.
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
    * Higher values make the system LESS sensitive.
1266
    * Higher values make the system LESS sensitive.
1267
    * Lower value make the system MORE sensitive.
1267
    * Lower value make the system MORE sensitive.
1268
    * Too low values can lead to false positives, while too high values will collide the axis without triggering.
1268
    * Too low values can lead to false positives, while too high values will collide the axis without triggering.
1271
    */
1271
    */
1272
   //#define SENSORLESS_HOMING // TMC2130 only
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
   #endif
1286
   #endif
1279
 
1287
 
1280
   /**
1288
   /**

+ 3
- 3
Marlin/src/feature/tmc_util.cpp Zobrazit soubor

663
 
663
 
664
 #endif // TMC_DEBUG
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
     st.coolstep_min_speed(enable ? 1024UL * 1024UL - 1UL : 0);
669
     st.coolstep_min_speed(enable ? 1024UL * 1024UL - 1UL : 0);
670
     #if ENABLED(STEALTHCHOP)
670
     #if ENABLED(STEALTHCHOP)
671
       st.stealthChop(!enable);
671
       st.stealthChop(!enable);
673
     st.diag1_stall(enable ? 1 : 0);
673
     st.diag1_stall(enable ? 1 : 0);
674
   }
674
   }
675
 
675
 
676
-#endif // SENSORLESS_HOMING
676
+#endif // USE_SENSORLESS
677
 
677
 
678
 #if HAS_DRIVER(TMC2130)
678
 #if HAS_DRIVER(TMC2130)
679
   #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
679
   #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)

+ 2
- 2
Marlin/src/feature/tmc_util.h Zobrazit soubor

128
  *
128
  *
129
  * Defined here because of limitations with templates and headers.
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
 #endif
133
 #endif
134
 
134
 
135
 #if HAS_DRIVER(TMC2130)
135
 #if HAS_DRIVER(TMC2130)

+ 3
- 3
Marlin/src/gcode/feature/trinamic/M911-M915.cpp Zobrazit soubor

267
 #endif // HYBRID_THRESHOLD
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
   void GcodeSuite::M914() {
273
   void GcodeSuite::M914() {
274
     #define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q, TMC_##Q)
274
     #define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q, TMC_##Q)
275
     #define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, value)
275
     #define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, value)
346
       #endif
346
       #endif
347
     }
347
     }
348
   }
348
   }
349
-#endif // SENSORLESS_HOMING
349
+#endif // USE_SENSORLESS
350
 
350
 
351
 /**
351
 /**
352
  * TMC Z axis calibration routine
352
  * TMC Z axis calibration routine

+ 2
- 2
Marlin/src/gcode/gcode.cpp Zobrazit soubor

637
         #if ENABLED(HYBRID_THRESHOLD)
637
         #if ENABLED(HYBRID_THRESHOLD)
638
           case 913: M913(); break;                                // M913: Set HYBRID_THRESHOLD speed.
638
           case 913: M913(); break;                                // M913: Set HYBRID_THRESHOLD speed.
639
         #endif
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
         #endif
642
         #endif
643
         #if ENABLED(TMC_Z_CALIBRATION)
643
         #if ENABLED(TMC_Z_CALIBRATION)
644
           case 915: M915(); break;                                // M915: TMC Z axis calibration.
644
           case 915: M915(); break;                                // M915: TMC Z axis calibration.

+ 2
- 2
Marlin/src/gcode/gcode.h Zobrazit soubor

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

+ 1
- 1
Marlin/src/inc/Conditionals_LCD.h Zobrazit soubor

528
 /**
528
 /**
529
  * Set flags for enabled probes
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
 #define PROBE_SELECTED (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING))
532
 #define PROBE_SELECTED (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING))
533
 
533
 
534
 #if !HAS_BED_PROBE
534
 #if !HAS_BED_PROBE

+ 6
- 5
Marlin/src/inc/Conditionals_post.h Zobrazit soubor

869
 #define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
869
 #define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
870
 #define AXIS_HAS_STALLGUARD(ST) AXIS_DRIVER_TYPE(ST, TMC2130)
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
   // Disable Z axis sensorless homing if a probe is used to home the Z axis
874
   // Disable Z axis sensorless homing if a probe is used to home the Z axis
874
   #if HOMING_Z_WITH_PROBE
875
   #if HOMING_Z_WITH_PROBE
875
-    #undef Z_HOMING_SENSITIVITY
876
+    #undef Z_STALL_SENSITIVITY
876
   #endif
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
 #endif
881
 #endif
881
 
882
 
882
 // Endstops and bed probe
883
 // Endstops and bed probe

+ 15
- 10
Marlin/src/inc/SanityCheck.h Zobrazit soubor

895
   /**
895
   /**
896
    * Require pin options and pins to be defined
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
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
905
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
900
       #error "Enable only one option: Z_MIN_PROBE_ENDSTOP or Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN."
906
       #error "Enable only one option: Z_MIN_PROBE_ENDSTOP or Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN."
901
     #elif DISABLED(USE_ZMIN_PLUG)
907
     #elif DISABLED(USE_ZMIN_PLUG)
1746
   #error "CoreYZ requires both Y and Z to use sensorless homing if either does."
1752
   #error "CoreYZ requires both Y and Z to use sensorless homing if either does."
1747
 #endif
1753
 #endif
1748
 
1754
 
1755
+// Other TMC feature requirements
1749
 #if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
1756
 #if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
1750
   #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
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
   #error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis"
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
   #error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers."
1765
   #error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers."
1761
- #endif
1766
+#endif
1762
 
1767
 
1763
 /**
1768
 /**
1764
  * Digipot requirement
1769
  * Digipot requirement

+ 16
- 16
Marlin/src/module/configuration_store.cpp Zobrazit soubor

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

+ 9
- 9
Marlin/src/module/motion.cpp Zobrazit soubor

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

+ 39
- 9
Marlin/src/module/probe.cpp Zobrazit soubor

58
   #include "../module/servo.h"
58
   #include "../module/servo.h"
59
 #endif
59
 #endif
60
 
60
 
61
+#if ENABLED(SENSORLESS_PROBING)
62
+  #include "stepper.h"
63
+  #include "../feature/tmc_util.h"
64
+#endif
65
+
61
 #if ENABLED(Z_PROBE_SLED)
66
 #if ENABLED(Z_PROBE_SLED)
62
 
67
 
63
   #ifndef SLED_DOCKING_OFFSET
68
   #ifndef SLED_DOCKING_OFFSET
527
     if (set_bltouch_deployed(true)) return true;
532
     if (set_bltouch_deployed(true)) return true;
528
   #endif
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
   #if QUIET_PROBING
544
   #if QUIET_PROBING
531
     probing_pause(true);
545
     probing_pause(true);
532
   #endif
546
   #endif
533
 
547
 
548
+  endstops.enable(true);
549
+
534
   // Move down until probe triggered
550
   // Move down until probe triggered
535
   do_blocking_move_to_z(z, fr_mm_s);
551
   do_blocking_move_to_z(z, fr_mm_s);
536
 
552
 
537
   // Check to see if the probe was triggered
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
     #else
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
     #endif
565
     #endif
544
-  );
566
+  ;
545
 
567
 
546
   #if QUIET_PROBING
568
   #if QUIET_PROBING
547
     probing_pause(false);
569
     probing_pause(false);
548
   #endif
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
   // Retract BLTouch immediately after a probe if it was triggered
581
   // Retract BLTouch immediately after a probe if it was triggered
551
   #if ENABLED(BLTOUCH)
582
   #if ENABLED(BLTOUCH)
552
     if (probe_triggered && set_bltouch_deployed(false)) return true;
583
     if (probe_triggered && set_bltouch_deployed(false)) return true;
553
   #endif
584
   #endif
554
 
585
 
586
+  // Clear endstop flags
555
   endstops.hit_on_purpose();
587
   endstops.hit_on_purpose();
556
 
588
 
557
   // Get Z where the steppers were interrupted
589
   // Get Z where the steppers were interrupted
606
     // move up to make clearance for the probe
638
     // move up to make clearance for the probe
607
     do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
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
     // If the nozzle is well over the travel height then
643
     // If the nozzle is well over the travel height then
612
     // move down quickly before doing the slow probe
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
     if (current_position[Z_AXIS] > z) {
646
     if (current_position[Z_AXIS] > z) {
617
       // If we don't make it to the z position (i.e. the probe triggered), move up to make clearance for the probe
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
       if (!do_probe_move(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))
648
       if (!do_probe_move(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))

+ 9
- 9
Marlin/src/module/stepper_indirection.cpp Zobrazit soubor

273
       { constexpr uint8_t extruder = 5; _TMC2130_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
273
       { constexpr uint8_t extruder = 5; _TMC2130_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
274
     #endif
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
       #if X_SENSORLESS
278
       #if X_SENSORLESS
279
         #if AXIS_DRIVER_TYPE(X, TMC2130)
279
         #if AXIS_DRIVER_TYPE(X, TMC2130)
280
-          stepperX.sgt(X_HOMING_SENSITIVITY);
280
+          stepperX.sgt(X_STALL_SENSITIVITY);
281
         #endif
281
         #endif
282
         #if AXIS_DRIVER_TYPE(X2, TMC2130)
282
         #if AXIS_DRIVER_TYPE(X2, TMC2130)
283
-          stepperX2.sgt(X_HOMING_SENSITIVITY);
283
+          stepperX2.sgt(X_STALL_SENSITIVITY);
284
         #endif
284
         #endif
285
       #endif
285
       #endif
286
       #if Y_SENSORLESS
286
       #if Y_SENSORLESS
287
         #if AXIS_DRIVER_TYPE(Y, TMC2130)
287
         #if AXIS_DRIVER_TYPE(Y, TMC2130)
288
-          stepperY.sgt(Y_HOMING_SENSITIVITY);
288
+          stepperY.sgt(Y_STALL_SENSITIVITY);
289
         #endif
289
         #endif
290
         #if AXIS_DRIVER_TYPE(Y2, TMC2130)
290
         #if AXIS_DRIVER_TYPE(Y2, TMC2130)
291
-          stepperY2.sgt(Y_HOMING_SENSITIVITY);
291
+          stepperY2.sgt(Y_STALL_SENSITIVITY);
292
         #endif
292
         #endif
293
       #endif
293
       #endif
294
       #if Z_SENSORLESS
294
       #if Z_SENSORLESS
295
         #if AXIS_DRIVER_TYPE(Z, TMC2130)
295
         #if AXIS_DRIVER_TYPE(Z, TMC2130)
296
-          stepperZ.sgt(Z_HOMING_SENSITIVITY);
296
+          stepperZ.sgt(Z_STALL_SENSITIVITY);
297
         #endif
297
         #endif
298
         #if AXIS_DRIVER_TYPE(Z2, TMC2130)
298
         #if AXIS_DRIVER_TYPE(Z2, TMC2130)
299
-          stepperZ2.sgt(Z_HOMING_SENSITIVITY);
299
+          stepperZ2.sgt(Z_STALL_SENSITIVITY);
300
         #endif
300
         #endif
301
         #if ENABLED(Z3_IS_TMC2130)
301
         #if ENABLED(Z3_IS_TMC2130)
302
-          stepperZ3.sgt(Z_HOMING_SENSITIVITY);
302
+          stepperZ3.sgt(Z_STALL_SENSITIVITY);
303
         #endif
303
         #endif
304
       #endif
304
       #endif
305
     #endif
305
     #endif

+ 11
- 0
buildroot/share/tests/LPC1768_tests Zobrazit soubor

60
 opt_enable USE_XMAX_PLUG
60
 opt_enable USE_XMAX_PLUG
61
 exec_test $1 $2 "MKS SBASE Many less common options"
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
 #clean up
74
 #clean up
64
 restore_configs
75
 restore_configs

+ 1
- 0
buildroot/share/tests/megaatmega2560_tests Zobrazit soubor

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

Loading…
Zrušit
Uložit