Browse Source

Configure TMC interpolation per driver (#19828)

ManuelMcLure 4 years ago
parent
commit
4fccb92e07
No account linked to committer's email address

+ 24
- 3
Marlin/Configuration_adv.h View File

2261
 #if HAS_TRINAMIC_CONFIG
2261
 #if HAS_TRINAMIC_CONFIG
2262
 
2262
 
2263
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
2263
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
2264
-  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
2264
+
2265
+  /**
2266
+   * Interpolate microsteps to 256
2267
+   * Override for each driver with <driver>_INTERPOLATE settings below
2268
+   */
2269
+  #define INTERPOLATE      true
2265
 
2270
 
2266
   #if AXIS_IS_TMC(X)
2271
   #if AXIS_IS_TMC(X)
2267
     #define X_CURRENT       800        // (mA) RMS current. Multiply by 1.414 for peak current.
2272
     #define X_CURRENT       800        // (mA) RMS current. Multiply by 1.414 for peak current.
2268
     #define X_CURRENT_HOME  X_CURRENT  // (mA) RMS current for sensorless homing
2273
     #define X_CURRENT_HOME  X_CURRENT  // (mA) RMS current for sensorless homing
2269
-    #define X_MICROSTEPS     16    // 0..256
2274
+    #define X_MICROSTEPS     16        // 0..256
2270
     #define X_RSENSE          0.11
2275
     #define X_RSENSE          0.11
2271
-    #define X_CHAIN_POS      -1    // <=0 : Not chained. 1 : MCU MOSI connected. 2 : Next in chain, ...
2276
+    #define X_CHAIN_POS      -1        // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ...
2277
+    //#define X_INTERPOLATE  true      // Enable to override 'INTERPOLATE' for the X axis
2272
   #endif
2278
   #endif
2273
 
2279
 
2274
   #if AXIS_IS_TMC(X2)
2280
   #if AXIS_IS_TMC(X2)
2277
     #define X2_MICROSTEPS    16
2283
     #define X2_MICROSTEPS    16
2278
     #define X2_RSENSE         0.11
2284
     #define X2_RSENSE         0.11
2279
     #define X2_CHAIN_POS     -1
2285
     #define X2_CHAIN_POS     -1
2286
+    //#define X2_INTERPOLATE true
2280
   #endif
2287
   #endif
2281
 
2288
 
2282
   #if AXIS_IS_TMC(Y)
2289
   #if AXIS_IS_TMC(Y)
2285
     #define Y_MICROSTEPS     16
2292
     #define Y_MICROSTEPS     16
2286
     #define Y_RSENSE          0.11
2293
     #define Y_RSENSE          0.11
2287
     #define Y_CHAIN_POS      -1
2294
     #define Y_CHAIN_POS      -1
2295
+    //#define Y_INTERPOLATE  true
2288
   #endif
2296
   #endif
2289
 
2297
 
2290
   #if AXIS_IS_TMC(Y2)
2298
   #if AXIS_IS_TMC(Y2)
2293
     #define Y2_MICROSTEPS    16
2301
     #define Y2_MICROSTEPS    16
2294
     #define Y2_RSENSE         0.11
2302
     #define Y2_RSENSE         0.11
2295
     #define Y2_CHAIN_POS     -1
2303
     #define Y2_CHAIN_POS     -1
2304
+    //#define Y2_INTERPOLATE true
2296
   #endif
2305
   #endif
2297
 
2306
 
2298
   #if AXIS_IS_TMC(Z)
2307
   #if AXIS_IS_TMC(Z)
2301
     #define Z_MICROSTEPS     16
2310
     #define Z_MICROSTEPS     16
2302
     #define Z_RSENSE          0.11
2311
     #define Z_RSENSE          0.11
2303
     #define Z_CHAIN_POS      -1
2312
     #define Z_CHAIN_POS      -1
2313
+    //#define Z_INTERPOLATE  true
2304
   #endif
2314
   #endif
2305
 
2315
 
2306
   #if AXIS_IS_TMC(Z2)
2316
   #if AXIS_IS_TMC(Z2)
2309
     #define Z2_MICROSTEPS    16
2319
     #define Z2_MICROSTEPS    16
2310
     #define Z2_RSENSE         0.11
2320
     #define Z2_RSENSE         0.11
2311
     #define Z2_CHAIN_POS     -1
2321
     #define Z2_CHAIN_POS     -1
2322
+    //#define Z2_INTERPOLATE true
2312
   #endif
2323
   #endif
2313
 
2324
 
2314
   #if AXIS_IS_TMC(Z3)
2325
   #if AXIS_IS_TMC(Z3)
2317
     #define Z3_MICROSTEPS    16
2328
     #define Z3_MICROSTEPS    16
2318
     #define Z3_RSENSE         0.11
2329
     #define Z3_RSENSE         0.11
2319
     #define Z3_CHAIN_POS     -1
2330
     #define Z3_CHAIN_POS     -1
2331
+    //#define Z3_INTERPOLATE true
2320
   #endif
2332
   #endif
2321
 
2333
 
2322
   #if AXIS_IS_TMC(Z4)
2334
   #if AXIS_IS_TMC(Z4)
2325
     #define Z4_MICROSTEPS    16
2337
     #define Z4_MICROSTEPS    16
2326
     #define Z4_RSENSE         0.11
2338
     #define Z4_RSENSE         0.11
2327
     #define Z4_CHAIN_POS     -1
2339
     #define Z4_CHAIN_POS     -1
2340
+    //#define Z4_INTERPOLATE true
2328
   #endif
2341
   #endif
2329
 
2342
 
2330
   #if AXIS_IS_TMC(E0)
2343
   #if AXIS_IS_TMC(E0)
2332
     #define E0_MICROSTEPS    16
2345
     #define E0_MICROSTEPS    16
2333
     #define E0_RSENSE         0.11
2346
     #define E0_RSENSE         0.11
2334
     #define E0_CHAIN_POS     -1
2347
     #define E0_CHAIN_POS     -1
2348
+    //#define E0_INTERPOLATE true
2335
   #endif
2349
   #endif
2336
 
2350
 
2337
   #if AXIS_IS_TMC(E1)
2351
   #if AXIS_IS_TMC(E1)
2339
     #define E1_MICROSTEPS    16
2353
     #define E1_MICROSTEPS    16
2340
     #define E1_RSENSE         0.11
2354
     #define E1_RSENSE         0.11
2341
     #define E1_CHAIN_POS     -1
2355
     #define E1_CHAIN_POS     -1
2356
+    //#define E1_INTERPOLATE true
2342
   #endif
2357
   #endif
2343
 
2358
 
2344
   #if AXIS_IS_TMC(E2)
2359
   #if AXIS_IS_TMC(E2)
2346
     #define E2_MICROSTEPS    16
2361
     #define E2_MICROSTEPS    16
2347
     #define E2_RSENSE         0.11
2362
     #define E2_RSENSE         0.11
2348
     #define E2_CHAIN_POS     -1
2363
     #define E2_CHAIN_POS     -1
2364
+    //#define E2_INTERPOLATE true
2349
   #endif
2365
   #endif
2350
 
2366
 
2351
   #if AXIS_IS_TMC(E3)
2367
   #if AXIS_IS_TMC(E3)
2353
     #define E3_MICROSTEPS    16
2369
     #define E3_MICROSTEPS    16
2354
     #define E3_RSENSE         0.11
2370
     #define E3_RSENSE         0.11
2355
     #define E3_CHAIN_POS     -1
2371
     #define E3_CHAIN_POS     -1
2372
+    //#define E3_INTERPOLATE true
2356
   #endif
2373
   #endif
2357
 
2374
 
2358
   #if AXIS_IS_TMC(E4)
2375
   #if AXIS_IS_TMC(E4)
2360
     #define E4_MICROSTEPS    16
2377
     #define E4_MICROSTEPS    16
2361
     #define E4_RSENSE         0.11
2378
     #define E4_RSENSE         0.11
2362
     #define E4_CHAIN_POS     -1
2379
     #define E4_CHAIN_POS     -1
2380
+    //#define E4_INTERPOLATE true
2363
   #endif
2381
   #endif
2364
 
2382
 
2365
   #if AXIS_IS_TMC(E5)
2383
   #if AXIS_IS_TMC(E5)
2367
     #define E5_MICROSTEPS    16
2385
     #define E5_MICROSTEPS    16
2368
     #define E5_RSENSE         0.11
2386
     #define E5_RSENSE         0.11
2369
     #define E5_CHAIN_POS     -1
2387
     #define E5_CHAIN_POS     -1
2388
+    //#define E5_INTERPOLATE true
2370
   #endif
2389
   #endif
2371
 
2390
 
2372
   #if AXIS_IS_TMC(E6)
2391
   #if AXIS_IS_TMC(E6)
2374
     #define E6_MICROSTEPS    16
2393
     #define E6_MICROSTEPS    16
2375
     #define E6_RSENSE         0.11
2394
     #define E6_RSENSE         0.11
2376
     #define E6_CHAIN_POS     -1
2395
     #define E6_CHAIN_POS     -1
2396
+    //#define E6_INTERPOLATE true
2377
   #endif
2397
   #endif
2378
 
2398
 
2379
   #if AXIS_IS_TMC(E7)
2399
   #if AXIS_IS_TMC(E7)
2381
     #define E7_MICROSTEPS    16
2401
     #define E7_MICROSTEPS    16
2382
     #define E7_RSENSE         0.11
2402
     #define E7_RSENSE         0.11
2383
     #define E7_CHAIN_POS     -1
2403
     #define E7_CHAIN_POS     -1
2404
+    //#define E7_INTERPOLATE true
2384
   #endif
2405
   #endif
2385
 
2406
 
2386
   /**
2407
   /**

+ 12
- 1
Marlin/src/feature/tmc_util.cpp View File

497
     TMC_HEND,
497
     TMC_HEND,
498
     TMC_HSTRT,
498
     TMC_HSTRT,
499
     TMC_SGT,
499
     TMC_SGT,
500
-    TMC_MSCNT
500
+    TMC_MSCNT,
501
+    TMC_INTERPOLATE
501
   };
502
   };
502
   enum TMC_drv_status_enum : char {
503
   enum TMC_drv_status_enum : char {
503
     TMC_DRV_CODES,
504
     TMC_DRV_CODES,
553
         case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
554
         case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
554
         case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
555
         case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
555
         case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
556
         case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
557
+        case TMC_INTERPOLATE: serialprint_truefalse(st.intpol()); break;
556
         default: break;
558
         default: break;
557
       }
559
       }
558
     }
560
     }
588
             SERIAL_ECHOPGM("/256");
590
             SERIAL_ECHOPGM("/256");
589
           }
591
           }
590
           break;
592
           break;
593
+        case TMC_INTERPOLATE: serialprint_truefalse(st.intpol()); break;
591
         default: break;
594
         default: break;
592
       }
595
       }
593
     }
596
     }
603
         case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break;
606
         case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break;
604
         case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('*'); break;
607
         case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('*'); break;
605
         case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('*'); break;
608
         case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('*'); break;
609
+        case TMC_INTERPOLATE: serialprint_truefalse(st.intpol()); break;
606
         default: break;
610
         default: break;
607
       }
611
       }
608
     }
612
     }
644
 
648
 
645
   #if HAS_DRIVER(TMC2660)
649
   #if HAS_DRIVER(TMC2660)
646
     static void _tmc_parse_drv_status(TMC2660Stepper, const TMC_drv_status_enum) { }
650
     static void _tmc_parse_drv_status(TMC2660Stepper, const TMC_drv_status_enum) { }
651
+    static void _tmc_status(TMC2660Stepper &st, const TMC_debug_enum i) {
652
+      switch (i) {
653
+        case TMC_INTERPOLATE: serialprint_truefalse(st.intpol()); break;
654
+        default: break;
655
+      }
656
+    }
647
   #endif
657
   #endif
648
 
658
 
649
   template <typename TMC>
659
   template <typename TMC>
902
     #endif
912
     #endif
903
     TMC_REPORT("stealthChop",        TMC_STEALTHCHOP);
913
     TMC_REPORT("stealthChop",        TMC_STEALTHCHOP);
904
     TMC_REPORT("msteps\t",           TMC_MICROSTEPS);
914
     TMC_REPORT("msteps\t",           TMC_MICROSTEPS);
915
+    TMC_REPORT("interp\t",           TMC_INTERPOLATE);
905
     TMC_REPORT("tstep\t",            TMC_TSTEP);
916
     TMC_REPORT("tstep\t",            TMC_TSTEP);
906
     TMC_REPORT("PWM thresh.",        TMC_TPWMTHRS);
917
     TMC_REPORT("PWM thresh.",        TMC_TPWMTHRS);
907
     TMC_REPORT("[mm/s]\t",           TMC_TPWMTHRS_MMS);
918
     TMC_REPORT("[mm/s]\t",           TMC_TPWMTHRS_MMS);

+ 48
- 0
Marlin/src/inc/Conditionals_post.h View File

1608
     #define Y_SPI_SENSORLESS Y_SENSORLESS
1608
     #define Y_SPI_SENSORLESS Y_SENSORLESS
1609
     #define Z_SPI_SENSORLESS Z_SENSORLESS
1609
     #define Z_SPI_SENSORLESS Z_SENSORLESS
1610
   #endif
1610
   #endif
1611
+  #ifndef X_INTERPOLATE
1612
+    #define X_INTERPOLATE INTERPOLATE
1613
+  #endif
1614
+  #ifndef X2_INTERPOLATE
1615
+    #define X2_INTERPOLATE INTERPOLATE
1616
+  #endif
1617
+  #ifndef Y_INTERPOLATE
1618
+    #define Y_INTERPOLATE INTERPOLATE
1619
+  #endif
1620
+  #ifndef Y2_INTERPOLATE
1621
+    #define Y2_INTERPOLATE INTERPOLATE
1622
+  #endif
1623
+  #ifndef Z_INTERPOLATE
1624
+    #define Z_INTERPOLATE INTERPOLATE
1625
+  #endif
1626
+  #ifndef Z2_INTERPOLATE
1627
+    #define Z2_INTERPOLATE INTERPOLATE
1628
+  #endif
1629
+  #ifndef Z3_INTERPOLATE
1630
+    #define Z3_INTERPOLATE INTERPOLATE
1631
+  #endif
1632
+  #ifndef Z4_INTERPOLATE
1633
+    #define Z4_INTERPOLATE INTERPOLATE
1634
+  #endif
1635
+  #ifndef E0_INTERPOLATE
1636
+    #define E0_INTERPOLATE INTERPOLATE
1637
+  #endif
1638
+  #ifndef E1_INTERPOLATE
1639
+    #define E1_INTERPOLATE INTERPOLATE
1640
+  #endif
1641
+  #ifndef E2_INTERPOLATE
1642
+    #define E2_INTERPOLATE INTERPOLATE
1643
+  #endif
1644
+  #ifndef E3_INTERPOLATE
1645
+    #define E3_INTERPOLATE INTERPOLATE
1646
+  #endif
1647
+  #ifndef E4_INTERPOLATE
1648
+    #define E4_INTERPOLATE INTERPOLATE
1649
+  #endif
1650
+  #ifndef E5_INTERPOLATE
1651
+    #define E5_INTERPOLATE INTERPOLATE
1652
+  #endif
1653
+  #ifndef E6_INTERPOLATE
1654
+    #define E6_INTERPOLATE INTERPOLATE
1655
+  #endif
1656
+  #ifndef E7_INTERPOLATE
1657
+    #define E7_INTERPOLATE INTERPOLATE
1658
+  #endif
1611
 #endif
1659
 #endif
1612
 
1660
 
1613
 #if (HAS_E_DRIVER(TMC2660) \
1661
 #if (HAS_E_DRIVER(TMC2660) \

+ 15
- 15
Marlin/src/module/stepper/trinamic.cpp View File

36
 #include <SPI.h>
36
 #include <SPI.h>
37
 
37
 
38
 enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
38
 enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
39
-#define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX], chopper_timing_##ST)
39
+#define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX], chopper_timing_##ST, ST##_INTERPOLATE)
40
 
40
 
41
 //   IC = TMC model number
41
 //   IC = TMC model number
42
 //   ST = Stepper object letter
42
 //   ST = Stepper object letter
131
 
131
 
132
 #if HAS_DRIVER(TMC2130)
132
 #if HAS_DRIVER(TMC2130)
133
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
133
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
134
-  void tmc_init(TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) {
134
+  void tmc_init(TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
135
     st.begin();
135
     st.begin();
136
 
136
 
137
     CHOPCONF_t chopconf{0};
137
     CHOPCONF_t chopconf{0};
138
     chopconf.tbl = 0b01;
138
     chopconf.tbl = 0b01;
139
     chopconf.toff = chop_init.toff;
139
     chopconf.toff = chop_init.toff;
140
-    chopconf.intpol = INTERPOLATE;
140
+    chopconf.intpol = interpolate;
141
     chopconf.hend = chop_init.hend + 3;
141
     chopconf.hend = chop_init.hend + 3;
142
     chopconf.hstrt = chop_init.hstrt - 1;
142
     chopconf.hstrt = chop_init.hstrt - 1;
143
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
143
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
166
 
166
 
167
 #if HAS_DRIVER(TMC2160)
167
 #if HAS_DRIVER(TMC2160)
168
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
168
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
169
-  void tmc_init(TMCMarlin<TMC2160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) {
169
+  void tmc_init(TMCMarlin<TMC2160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
170
     st.begin();
170
     st.begin();
171
 
171
 
172
     CHOPCONF_t chopconf{0};
172
     CHOPCONF_t chopconf{0};
173
     chopconf.tbl = 0b01;
173
     chopconf.tbl = 0b01;
174
     chopconf.toff = chop_init.toff;
174
     chopconf.toff = chop_init.toff;
175
-    chopconf.intpol = INTERPOLATE;
175
+    chopconf.intpol = interpolate;
176
     chopconf.hend = chop_init.hend + 3;
176
     chopconf.hend = chop_init.hend + 3;
177
     chopconf.hstrt = chop_init.hstrt - 1;
177
     chopconf.hstrt = chop_init.hstrt - 1;
178
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
178
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
484
 
484
 
485
 #if HAS_DRIVER(TMC2208)
485
 #if HAS_DRIVER(TMC2208)
486
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
486
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
487
-  void tmc_init(TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) {
487
+  void tmc_init(TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
488
     TMC2208_n::GCONF_t gconf{0};
488
     TMC2208_n::GCONF_t gconf{0};
489
     gconf.pdn_disable = true; // Use UART
489
     gconf.pdn_disable = true; // Use UART
490
     gconf.mstep_reg_select = true; // Select microsteps with UART
490
     gconf.mstep_reg_select = true; // Select microsteps with UART
496
     TMC2208_n::CHOPCONF_t chopconf{0};
496
     TMC2208_n::CHOPCONF_t chopconf{0};
497
     chopconf.tbl = 0b01; // blank_time = 24
497
     chopconf.tbl = 0b01; // blank_time = 24
498
     chopconf.toff = chop_init.toff;
498
     chopconf.toff = chop_init.toff;
499
-    chopconf.intpol = INTERPOLATE;
499
+    chopconf.intpol = interpolate;
500
     chopconf.hend = chop_init.hend + 3;
500
     chopconf.hend = chop_init.hend + 3;
501
     chopconf.hstrt = chop_init.hstrt - 1;
501
     chopconf.hstrt = chop_init.hstrt - 1;
502
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
502
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
526
 
526
 
527
 #if HAS_DRIVER(TMC2209)
527
 #if HAS_DRIVER(TMC2209)
528
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
528
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
529
-  void tmc_init(TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) {
529
+  void tmc_init(TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
530
     TMC2208_n::GCONF_t gconf{0};
530
     TMC2208_n::GCONF_t gconf{0};
531
     gconf.pdn_disable = true; // Use UART
531
     gconf.pdn_disable = true; // Use UART
532
     gconf.mstep_reg_select = true; // Select microsteps with UART
532
     gconf.mstep_reg_select = true; // Select microsteps with UART
538
     TMC2208_n::CHOPCONF_t chopconf{0};
538
     TMC2208_n::CHOPCONF_t chopconf{0};
539
     chopconf.tbl = 0b01; // blank_time = 24
539
     chopconf.tbl = 0b01; // blank_time = 24
540
     chopconf.toff = chop_init.toff;
540
     chopconf.toff = chop_init.toff;
541
-    chopconf.intpol = INTERPOLATE;
541
+    chopconf.intpol = interpolate;
542
     chopconf.hend = chop_init.hend + 3;
542
     chopconf.hend = chop_init.hend + 3;
543
     chopconf.hstrt = chop_init.hstrt - 1;
543
     chopconf.hstrt = chop_init.hstrt - 1;
544
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
544
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
568
 
568
 
569
 #if HAS_DRIVER(TMC2660)
569
 #if HAS_DRIVER(TMC2660)
570
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
570
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
571
-  void tmc_init(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const bool, const chopper_timing_t &chop_init) {
571
+  void tmc_init(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const bool, const chopper_timing_t &chop_init, const bool interpolate) {
572
     st.begin();
572
     st.begin();
573
 
573
 
574
     TMC2660_n::CHOPCONF_t chopconf{0};
574
     TMC2660_n::CHOPCONF_t chopconf{0};
582
     st.rms_current(mA);
582
     st.rms_current(mA);
583
     st.microsteps(microsteps);
583
     st.microsteps(microsteps);
584
     TERN_(SQUARE_WAVE_STEPPING, st.dedge(true));
584
     TERN_(SQUARE_WAVE_STEPPING, st.dedge(true));
585
-    st.intpol(INTERPOLATE);
585
+    st.intpol(interpolate);
586
     st.diss2g(true); // Disable short to ground protection. Too many false readings?
586
     st.diss2g(true); // Disable short to ground protection. Too many false readings?
587
     TERN_(TMC_DEBUG, st.rdsel(0b01));
587
     TERN_(TMC_DEBUG, st.rdsel(0b01));
588
   }
588
   }
590
 
590
 
591
 #if HAS_DRIVER(TMC5130)
591
 #if HAS_DRIVER(TMC5130)
592
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
592
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
593
-  void tmc_init(TMCMarlin<TMC5130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) {
593
+  void tmc_init(TMCMarlin<TMC5130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
594
     st.begin();
594
     st.begin();
595
 
595
 
596
     CHOPCONF_t chopconf{0};
596
     CHOPCONF_t chopconf{0};
597
     chopconf.tbl = 0b01;
597
     chopconf.tbl = 0b01;
598
     chopconf.toff = chop_init.toff;
598
     chopconf.toff = chop_init.toff;
599
-    chopconf.intpol = INTERPOLATE;
599
+    chopconf.intpol = interpolate;
600
     chopconf.hend = chop_init.hend + 3;
600
     chopconf.hend = chop_init.hend + 3;
601
     chopconf.hstrt = chop_init.hstrt - 1;
601
     chopconf.hstrt = chop_init.hstrt - 1;
602
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
602
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
625
 
625
 
626
 #if HAS_DRIVER(TMC5160)
626
 #if HAS_DRIVER(TMC5160)
627
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
627
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
628
-  void tmc_init(TMCMarlin<TMC5160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) {
628
+  void tmc_init(TMCMarlin<TMC5160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
629
     st.begin();
629
     st.begin();
630
 
630
 
631
     CHOPCONF_t chopconf{0};
631
     CHOPCONF_t chopconf{0};
632
     chopconf.tbl = 0b01;
632
     chopconf.tbl = 0b01;
633
     chopconf.toff = chop_init.toff;
633
     chopconf.toff = chop_init.toff;
634
-    chopconf.intpol = INTERPOLATE;
634
+    chopconf.intpol = interpolate;
635
     chopconf.hend = chop_init.hend + 3;
635
     chopconf.hend = chop_init.hend + 3;
636
     chopconf.hstrt = chop_init.hstrt - 1;
636
     chopconf.hstrt = chop_init.hstrt - 1;
637
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
637
     TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);

Loading…
Cancel
Save