Browse Source

TMC2130 dual-stepper Sensorless Homing (#13061)

mattfredwill 5 years ago
parent
commit
c3cb449990

+ 1
- 1
Marlin/src/feature/tmc_util.h View File

@@ -278,7 +278,7 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
278 278
 #if USE_SENSORLESS
279 279
   // Track enabled status of stealthChop and only re-enable where applicable
280 280
   struct sensorless_t {
281
-    bool x, y, z;
281
+    bool x, y, z, x2, y2, z2, z3;
282 282
   };
283 283
 
284 284
   bool tmc_enable_stallguard(TMC2130Stepper &st);

+ 13
- 1
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -71,9 +71,15 @@
71 71
                 fr_mm_s = MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0);
72 72
 
73 73
     #if ENABLED(SENSORLESS_HOMING)
74
-      sensorless_t stealth_states { false, false, false };
74
+      sensorless_t stealth_states { false, false, false, false, false, false, false };
75 75
       stealth_states.x = tmc_enable_stallguard(stepperX);
76 76
       stealth_states.y = tmc_enable_stallguard(stepperY);
77
+      #if AXIS_HAS_STALLGUARD(X2)
78
+        stealth_states.x2 = tmc_enable_stallguard(stepperX2);
79
+      #endif
80
+      #if AXIS_HAS_STALLGUARD(Y2)
81
+        stealth_states.y2 = tmc_enable_stallguard(stepperY2);
82
+      #endif
77 83
     #endif
78 84
 
79 85
     do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
@@ -85,6 +91,12 @@
85 91
     #if ENABLED(SENSORLESS_HOMING)
86 92
       tmc_disable_stallguard(stepperX, stealth_states.x);
87 93
       tmc_disable_stallguard(stepperY, stealth_states.y);
94
+      #if AXIS_HAS_STALLGUARD(X2)
95
+        tmc_disable_stallguard(stepperX2, stealth_states.x2);
96
+      #endif
97
+      #if AXIS_HAS_STALLGUARD(Y2)
98
+        tmc_disable_stallguard(stepperY2, stealth_states.y2);
99
+      #endif
88 100
     #endif
89 101
   }
90 102
 

+ 1
- 1
Marlin/src/module/delta.cpp View File

@@ -222,7 +222,7 @@ void home_delta() {
222 222
 
223 223
   // Disable stealthChop if used. Enable diag1 pin on driver.
224 224
   #if ENABLED(SENSORLESS_HOMING)
225
-    sensorless_t stealth_states { false, false, false };
225
+    sensorless_t stealth_states { false, false, false, false, false, false, false };
226 226
     stealth_states.x = tmc_enable_stallguard(stepperX);
227 227
     stealth_states.y = tmc_enable_stallguard(stepperY);
228 228
     stealth_states.z = tmc_enable_stallguard(stepperZ);

+ 25
- 1
Marlin/src/module/motion.cpp View File

@@ -1050,13 +1050,16 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
1050 1050
    * Set sensorless homing if the axis has it, accounting for Core Kinematics.
1051 1051
    */
1052 1052
   sensorless_t start_sensorless_homing_per_axis(const AxisEnum axis) {
1053
-    sensorless_t stealth_states { false, false, false };
1053
+    sensorless_t stealth_states { false, false, false, false, false, false, false };
1054 1054
 
1055 1055
     switch (axis) {
1056 1056
       default: break;
1057 1057
       #if X_SENSORLESS
1058 1058
         case X_AXIS:
1059 1059
           stealth_states.x = tmc_enable_stallguard(stepperX);
1060
+          #if AXIS_HAS_STALLGUARD(X2)
1061
+            stealth_states.x2 = tmc_enable_stallguard(stepperX2);
1062
+          #endif
1060 1063
           #if CORE_IS_XY && Y_SENSORLESS
1061 1064
             stealth_states.y = tmc_enable_stallguard(stepperY);
1062 1065
           #elif CORE_IS_XZ && Z_SENSORLESS
@@ -1067,6 +1070,9 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
1067 1070
       #if Y_SENSORLESS
1068 1071
         case Y_AXIS:
1069 1072
           stealth_states.y = tmc_enable_stallguard(stepperY);
1073
+          #if AXIS_HAS_STALLGUARD(Y2)
1074
+            stealth_states.y2 = tmc_enable_stallguard(stepperY2);
1075
+          #endif
1070 1076
           #if CORE_IS_XY && X_SENSORLESS
1071 1077
             stealth_states.x = tmc_enable_stallguard(stepperX);
1072 1078
           #elif CORE_IS_YZ && Z_SENSORLESS
@@ -1077,6 +1083,12 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
1077 1083
       #if Z_SENSORLESS
1078 1084
         case Z_AXIS:
1079 1085
           stealth_states.z = tmc_enable_stallguard(stepperZ);
1086
+          #if AXIS_HAS_STALLGUARD(Z2)
1087
+            stealth_states.z2 = tmc_enable_stallguard(stepperZ2);
1088
+          #endif
1089
+          #if AXIS_HAS_STALLGUARD(Z3)
1090
+            stealth_states.z3 = tmc_enable_stallguard(stepperZ3);
1091
+          #endif
1080 1092
           #if CORE_IS_XZ && X_SENSORLESS
1081 1093
             stealth_states.x = tmc_enable_stallguard(stepperX);
1082 1094
           #elif CORE_IS_YZ && Y_SENSORLESS
@@ -1094,6 +1106,9 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
1094 1106
       #if X_SENSORLESS
1095 1107
         case X_AXIS:
1096 1108
           tmc_disable_stallguard(stepperX, enable_stealth.x);
1109
+          #if AXIS_HAS_STALLGUARD(X2)
1110
+            tmc_disable_stallguard(stepperX2, enable_stealth.x2);
1111
+          #endif
1097 1112
           #if CORE_IS_XY && Y_SENSORLESS
1098 1113
             tmc_disable_stallguard(stepperY, enable_stealth.y);
1099 1114
           #elif CORE_IS_XZ && Z_SENSORLESS
@@ -1104,6 +1119,9 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
1104 1119
       #if Y_SENSORLESS
1105 1120
         case Y_AXIS:
1106 1121
           tmc_disable_stallguard(stepperY, enable_stealth.y);
1122
+          #if AXIS_HAS_STALLGUARD(Y2)
1123
+            tmc_disable_stallguard(stepperY2, enable_stealth.y2);
1124
+          #endif
1107 1125
           #if CORE_IS_XY && X_SENSORLESS
1108 1126
             tmc_disable_stallguard(stepperX, enable_stealth.x);
1109 1127
           #elif CORE_IS_YZ && Z_SENSORLESS
@@ -1114,6 +1132,12 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
1114 1132
       #if Z_SENSORLESS
1115 1133
         case Z_AXIS:
1116 1134
           tmc_disable_stallguard(stepperZ, enable_stealth.z);
1135
+          #if AXIS_HAS_STALLGUARD(Z2)
1136
+            tmc_disable_stallguard(stepperZ2, enable_stealth.z2);
1137
+          #endif
1138
+          #if AXIS_HAS_STALLGUARD(Z3)
1139
+            tmc_disable_stallguard(stepperZ3, enable_stealth.z3);
1140
+          #endif
1117 1141
           #if CORE_IS_XZ && X_SENSORLESS
1118 1142
             tmc_disable_stallguard(stepperX, enable_stealth.x);
1119 1143
           #elif CORE_IS_YZ && Y_SENSORLESS

+ 1
- 1
Marlin/src/module/probe.cpp View File

@@ -551,7 +551,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
551 551
 
552 552
   // Disable stealthChop if used. Enable diag1 pin on driver.
553 553
   #if ENABLED(SENSORLESS_PROBING)
554
-    sensorless_t stealth_states { false, false, false };
554
+    sensorless_t stealth_states { false, false, false, false, false, false, false };
555 555
     #if ENABLED(DELTA)
556 556
       stealth_states.x = tmc_enable_stallguard(stepperX);
557 557
       stealth_states.y = tmc_enable_stallguard(stepperY);

Loading…
Cancel
Save