浏览代码

🐛 Fix TMC26X CS pins init (#23778)

ellensp 2 年前
父节点
当前提交
f03c367739
没有帐户链接到提交者的电子邮件
共有 5 个文件被更改,包括 69 次插入68 次删除
  1. 1
    1
      Marlin/src/MarlinCore.cpp
  2. 1
    1
      Marlin/src/core/drivers.h
  3. 63
    63
      Marlin/src/feature/tmc_util.cpp
  4. 2
    2
      Marlin/src/feature/tmc_util.h
  5. 2
    1
      ini/features.ini

+ 1
- 1
Marlin/src/MarlinCore.cpp 查看文件

@@ -145,7 +145,7 @@
145 145
   #include "feature/encoder_i2c.h"
146 146
 #endif
147 147
 
148
-#if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF)
148
+#if (HAS_TRINAMIC_CONFIG || HAS_TMC_SPI) && DISABLED(PSU_DEFAULT_OFF)
149 149
   #include "feature/tmc_util.h"
150 150
 #endif
151 151
 

+ 1
- 1
Marlin/src/core/drivers.h 查看文件

@@ -128,7 +128,7 @@
128 128
 // Test for a driver that uses SPI - this allows checking whether a _CS_ pin
129 129
 // is considered sensitive
130 130
 #define AXIS_HAS_SPI(A)  (    AXIS_DRIVER_TYPE(A,TMC2130) || AXIS_DRIVER_TYPE(A,TMC2160) \
131
-                           || AXIS_DRIVER_TYPE(A,TMC2660) \
131
+                           || AXIS_DRIVER_TYPE(A,TMC26X)  || AXIS_DRIVER_TYPE(A,TMC2660) \
132 132
                            || AXIS_DRIVER_TYPE(A,TMC5130) || AXIS_DRIVER_TYPE(A,TMC5160) )
133 133
 
134 134
 #define AXIS_HAS_UART(A) ( AXIS_DRIVER_TYPE(A,TMC2208) || AXIS_DRIVER_TYPE(A,TMC2209) )

+ 63
- 63
Marlin/src/feature/tmc_util.cpp 查看文件

@@ -1178,69 +1178,6 @@
1178 1178
 
1179 1179
 #endif // USE_SENSORLESS
1180 1180
 
1181
-#if HAS_TMC_SPI
1182
-  #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
1183
-  void tmc_init_cs_pins() {
1184
-    #if AXIS_HAS_SPI(X)
1185
-      SET_CS_PIN(X);
1186
-    #endif
1187
-    #if AXIS_HAS_SPI(Y)
1188
-      SET_CS_PIN(Y);
1189
-    #endif
1190
-    #if AXIS_HAS_SPI(Z)
1191
-      SET_CS_PIN(Z);
1192
-    #endif
1193
-    #if AXIS_HAS_SPI(X2)
1194
-      SET_CS_PIN(X2);
1195
-    #endif
1196
-    #if AXIS_HAS_SPI(Y2)
1197
-      SET_CS_PIN(Y2);
1198
-    #endif
1199
-    #if AXIS_HAS_SPI(Z2)
1200
-      SET_CS_PIN(Z2);
1201
-    #endif
1202
-    #if AXIS_HAS_SPI(Z3)
1203
-      SET_CS_PIN(Z3);
1204
-    #endif
1205
-    #if AXIS_HAS_SPI(Z4)
1206
-      SET_CS_PIN(Z4);
1207
-    #endif
1208
-    #if AXIS_HAS_SPI(I)
1209
-      SET_CS_PIN(I);
1210
-    #endif
1211
-    #if AXIS_HAS_SPI(J)
1212
-      SET_CS_PIN(J);
1213
-    #endif
1214
-    #if AXIS_HAS_SPI(K)
1215
-      SET_CS_PIN(K);
1216
-    #endif
1217
-    #if AXIS_HAS_SPI(E0)
1218
-      SET_CS_PIN(E0);
1219
-    #endif
1220
-    #if AXIS_HAS_SPI(E1)
1221
-      SET_CS_PIN(E1);
1222
-    #endif
1223
-    #if AXIS_HAS_SPI(E2)
1224
-      SET_CS_PIN(E2);
1225
-    #endif
1226
-    #if AXIS_HAS_SPI(E3)
1227
-      SET_CS_PIN(E3);
1228
-    #endif
1229
-    #if AXIS_HAS_SPI(E4)
1230
-      SET_CS_PIN(E4);
1231
-    #endif
1232
-    #if AXIS_HAS_SPI(E5)
1233
-      SET_CS_PIN(E5);
1234
-    #endif
1235
-    #if AXIS_HAS_SPI(E6)
1236
-      SET_CS_PIN(E6);
1237
-    #endif
1238
-    #if AXIS_HAS_SPI(E7)
1239
-      SET_CS_PIN(E7);
1240
-    #endif
1241
-  }
1242
-#endif // HAS_TMC_SPI
1243
-
1244 1181
 template<typename TMC>
1245 1182
 static bool test_connection(TMC &st) {
1246 1183
   SERIAL_ECHOPGM("Testing ");
@@ -1339,3 +1276,66 @@ void test_tmc_connection(LOGICAL_AXIS_ARGS(const bool)) {
1339 1276
 }
1340 1277
 
1341 1278
 #endif // HAS_TRINAMIC_CONFIG
1279
+
1280
+#if HAS_TMC_SPI
1281
+  #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
1282
+  void tmc_init_cs_pins() {
1283
+    #if AXIS_HAS_SPI(X)
1284
+      SET_CS_PIN(X);
1285
+    #endif
1286
+    #if AXIS_HAS_SPI(Y)
1287
+      SET_CS_PIN(Y);
1288
+    #endif
1289
+    #if AXIS_HAS_SPI(Z)
1290
+      SET_CS_PIN(Z);
1291
+    #endif
1292
+    #if AXIS_HAS_SPI(X2)
1293
+      SET_CS_PIN(X2);
1294
+    #endif
1295
+    #if AXIS_HAS_SPI(Y2)
1296
+      SET_CS_PIN(Y2);
1297
+    #endif
1298
+    #if AXIS_HAS_SPI(Z2)
1299
+      SET_CS_PIN(Z2);
1300
+    #endif
1301
+    #if AXIS_HAS_SPI(Z3)
1302
+      SET_CS_PIN(Z3);
1303
+    #endif
1304
+    #if AXIS_HAS_SPI(Z4)
1305
+      SET_CS_PIN(Z4);
1306
+    #endif
1307
+    #if AXIS_HAS_SPI(I)
1308
+      SET_CS_PIN(I);
1309
+    #endif
1310
+    #if AXIS_HAS_SPI(J)
1311
+      SET_CS_PIN(J);
1312
+    #endif
1313
+    #if AXIS_HAS_SPI(K)
1314
+      SET_CS_PIN(K);
1315
+    #endif
1316
+    #if AXIS_HAS_SPI(E0)
1317
+      SET_CS_PIN(E0);
1318
+    #endif
1319
+    #if AXIS_HAS_SPI(E1)
1320
+      SET_CS_PIN(E1);
1321
+    #endif
1322
+    #if AXIS_HAS_SPI(E2)
1323
+      SET_CS_PIN(E2);
1324
+    #endif
1325
+    #if AXIS_HAS_SPI(E3)
1326
+      SET_CS_PIN(E3);
1327
+    #endif
1328
+    #if AXIS_HAS_SPI(E4)
1329
+      SET_CS_PIN(E4);
1330
+    #endif
1331
+    #if AXIS_HAS_SPI(E5)
1332
+      SET_CS_PIN(E5);
1333
+    #endif
1334
+    #if AXIS_HAS_SPI(E6)
1335
+      SET_CS_PIN(E6);
1336
+    #endif
1337
+    #if AXIS_HAS_SPI(E7)
1338
+      SET_CS_PIN(E7);
1339
+    #endif
1340
+  }
1341
+#endif // HAS_TMC_SPI

+ 2
- 2
Marlin/src/feature/tmc_util.h 查看文件

@@ -382,8 +382,8 @@ void test_tmc_connection(LOGICAL_AXIS_DECL(const bool, true));
382 382
 
383 383
 #endif // USE_SENSORLESS
384 384
 
385
+#endif // HAS_TRINAMIC_CONFIG
386
+
385 387
 #if HAS_TMC_SPI
386 388
   void tmc_init_cs_pins();
387 389
 #endif
388
-
389
-#endif // HAS_TRINAMIC_CONFIG

+ 2
- 1
ini/features.ini 查看文件

@@ -18,7 +18,8 @@ POSTMORTEM_DEBUGGING                   = src_filter=+<src/HAL/shared/cpu_excepti
18 18
                                          build_flags=-funwind-tables
19 19
 MKS_WIFI_MODULE                        = QRCode=https://github.com/makerbase-mks/QRCode/archive/master.zip
20 20
 HAS_TRINAMIC_CONFIG                    = TMCStepper@~0.7.3
21
-                                         src_filter=+<src/feature/tmc_util.cpp> +<src/module/stepper/trinamic.cpp> +<src/gcode/feature/trinamic/M122.cpp> +<src/gcode/feature/trinamic/M906.cpp> +<src/gcode/feature/trinamic/M911-M914.cpp> +<src/gcode/feature/trinamic/M919.cpp>
21
+                                         +<src/module/stepper/trinamic.cpp> +<src/gcode/feature/trinamic/M122.cpp> +<src/gcode/feature/trinamic/M906.cpp> +<src/gcode/feature/trinamic/M911-M914.cpp> +<src/gcode/feature/trinamic/M919.cpp>
22
+HAS_T(RINAMIC_CONFIG|MC_SPI)           = src_filter=+<src/feature/tmc_util.cpp>
22 23
 HAS_STEALTHCHOP                        = src_filter=+<src/gcode/feature/trinamic/M569.cpp>
23 24
 SR_LCD_3W_NL                           = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
24 25
 HAS_MOTOR_CURRENT_I2C                  = SlowSoftI2CMaster

正在加载...
取消
保存