Преглед на файлове

Revert "Coolstep for TMC2130, 2209, 5130, 5160"

Reverting #16790 as not ready for primetime.
Scott Lahteine преди 4 години
родител
ревизия
18a7276909
променени са 4 файла, в които са добавени 9 реда и са изтрити 352 реда
  1. 0
    160
      Marlin/Configuration_adv.h
  2. 1
    15
      Marlin/src/feature/tmc_util.h
  3. 0
    56
      Marlin/src/inc/SanityCheck.h
  4. 8
    121
      Marlin/src/module/stepper/trinamic.cpp

+ 0
- 160
Marlin/Configuration_adv.h Целия файл

2276
   #define E7_HYBRID_THRESHOLD     30
2276
   #define E7_HYBRID_THRESHOLD     30
2277
 
2277
 
2278
   /**
2278
   /**
2279
-   * CoolStep. Currently supported for TMC2130, TMC2209, TMC5130 and TMC5160 only.
2280
-   * This mode allows for cooler steppers and energy savings.
2281
-   * The driver will switch to coolStep when stepper speed is over COOLSTEP_THRESHOLD mm/s.
2282
-   *
2283
-   * If SG_RESULT goes below COOLSTEP_LOWER_LOAD_THRESHOLD * 32 stepper current will be increased.
2284
-   * Set to 0 to disable CoolStep.
2285
-   *
2286
-   * If SG_RESULT goes above (COOLSTEP_LOWER_LOAD_THRESHOLD + COOLSTEP_UPPER_LOAD_THRESHOLD + 1) * 32
2287
-   * stepper current will be decreased.
2288
-   *
2289
-   * SEUP sets the increase step width. Value range is 0..3 and computed as 2^SEUP.
2290
-   * SEDN sets the decrease delay. Value range is 0..3, 0 being the slowest.
2291
-   * SEIMIN sets the lower current limit. 0: 1/2 of IRUN, 1:1/4 of IRUN
2292
-   */
2293
-
2294
-  #if AXIS_HAS_COOLSTEP(X)
2295
-    #define X_COOLSTEP_SPEED_THRESHOLD        5
2296
-    #define X_COOLSTEP_LOWER_LOAD_THRESHOLD   7
2297
-    #define X_COOLSTEP_UPPER_LOAD_THRESHOLD   0
2298
-    #define X_COOLSTEP_SEUP                   2
2299
-    #define X_COOLSTEP_SEDN                   0
2300
-    #define X_COOLSTEP_SEIMIN                 1
2301
-  #endif
2302
-
2303
-  #if AXIS_HAS_COOLSTEP(X2)
2304
-    #define X2_COOLSTEP_SPEED_THRESHOLD       5
2305
-    #define X2_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2306
-    #define X2_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2307
-    #define X2_COOLSTEP_SEUP                  2
2308
-    #define X2_COOLSTEP_SEDN                  0
2309
-    #define X2_COOLSTEP_SEIMIN                1
2310
-  #endif
2311
-
2312
-  #if AXIS_HAS_COOLSTEP(Y)
2313
-    #define Y_COOLSTEP_SPEED_THRESHOLD        5
2314
-    #define Y_COOLSTEP_LOWER_LOAD_THRESHOLD   7
2315
-    #define Y_COOLSTEP_UPPER_LOAD_THRESHOLD   0
2316
-    #define Y_COOLSTEP_SEUP                   2
2317
-    #define Y_COOLSTEP_SEDN                   0
2318
-    #define Y_COOLSTEP_SEIMIN                 1
2319
-  #endif
2320
-
2321
-  #if AXIS_HAS_COOLSTEP(Y2)
2322
-    #define Y2_COOLSTEP_SPEED_THRESHOLD       5
2323
-    #define Y2_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2324
-    #define Y2_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2325
-    #define Y2_COOLSTEP_SEUP                  2
2326
-    #define Y2_COOLSTEP_SEDN                  0
2327
-    #define Y2_COOLSTEP_SEIMIN                1
2328
-  #endif
2329
-
2330
-  #if AXIS_HAS_COOLSTEP(Z)
2331
-    #define Z_COOLSTEP_SPEED_THRESHOLD        5
2332
-    #define Z_COOLSTEP_LOWER_LOAD_THRESHOLD   7
2333
-    #define Z_COOLSTEP_UPPER_LOAD_THRESHOLD   0
2334
-    #define Z_COOLSTEP_SEUP                   2
2335
-    #define Z_COOLSTEP_SEDN                   0
2336
-    #define Z_COOLSTEP_SEIMIN                 1
2337
-  #endif
2338
-
2339
-  #if AXIS_HAS_COOLSTEP(Z2)
2340
-    #define Z2_COOLSTEP_SPEED_THRESHOLD       5
2341
-    #define Z2_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2342
-    #define Z2_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2343
-    #define Z2_COOLSTEP_SEUP                  2
2344
-    #define Z2_COOLSTEP_SEDN                  0
2345
-    #define Z2_COOLSTEP_SEIMIN                1
2346
-  #endif
2347
-
2348
-  #if AXIS_HAS_COOLSTEP(Z3)
2349
-    #define Z3_COOLSTEP_SPEED_THRESHOLD       5
2350
-    #define Z3_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2351
-    #define Z3_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2352
-    #define Z3_COOLSTEP_SEUP                  2
2353
-    #define Z3_COOLSTEP_SEDN                  0
2354
-    #define Z3_COOLSTEP_SEIMIN                1
2355
-  #endif
2356
-
2357
-  #if AXIS_HAS_COOLSTEP(Z4)
2358
-    #define Z4_COOLSTEP_SPEED_THRESHOLD       5
2359
-    #define Z4_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2360
-    #define Z4_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2361
-    #define Z4_COOLSTEP_SEUP                  2
2362
-    #define Z4_COOLSTEP_SEDN                  0
2363
-    #define Z4_COOLSTEP_SEIMIN                1
2364
-  #endif
2365
-
2366
-  #if AXIS_HAS_COOLSTEP(E0)
2367
-    #define E0_COOLSTEP_SPEED_THRESHOLD       5
2368
-    #define E0_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2369
-    #define E0_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2370
-    #define E0_COOLSTEP_SEUP                  2
2371
-    #define E0_COOLSTEP_SEDN                  0
2372
-    #define E0_COOLSTEP_SEIMIN                1
2373
-  #endif
2374
-
2375
-  #if AXIS_HAS_COOLSTEP(E1)
2376
-    #define E1_COOLSTEP_SPEED_THRESHOLD       5
2377
-    #define E1_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2378
-    #define E1_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2379
-    #define E1_COOLSTEP_SEUP                  2
2380
-    #define E1_COOLSTEP_SEDN                  0
2381
-    #define E1_COOLSTEP_SEIMIN                1
2382
-  #endif
2383
-
2384
-  #if AXIS_HAS_COOLSTEP(E2)
2385
-    #define E2_COOLSTEP_SPEED_THRESHOLD       5
2386
-    #define E2_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2387
-    #define E2_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2388
-    #define E2_COOLSTEP_SEUP                  2
2389
-    #define E2_COOLSTEP_SEDN                  0
2390
-    #define E2_COOLSTEP_SEIMIN                1
2391
-  #endif
2392
-
2393
-  #if AXIS_HAS_COOLSTEP(E3)
2394
-    #define E3_COOLSTEP_SPEED_THRESHOLD       5
2395
-    #define E3_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2396
-    #define E3_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2397
-    #define E3_COOLSTEP_SEUP                  2
2398
-    #define E3_COOLSTEP_SEDN                  0
2399
-    #define E3_COOLSTEP_SEIMIN                1
2400
-  #endif
2401
-
2402
-  #if AXIS_HAS_COOLSTEP(E4)
2403
-    #define E4_COOLSTEP_SPEED_THRESHOLD       5
2404
-    #define E4_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2405
-    #define E4_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2406
-    #define E4_COOLSTEP_SEUP                  2
2407
-    #define E4_COOLSTEP_SEDN                  0
2408
-    #define E4_COOLSTEP_SEIMIN                1
2409
-  #endif
2410
-
2411
-  #if AXIS_HAS_COOLSTEP(E5)
2412
-    #define E5_COOLSTEP_SPEED_THRESHOLD       5
2413
-    #define E5_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2414
-    #define E5_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2415
-    #define E5_COOLSTEP_SEUP                  2
2416
-    #define E5_COOLSTEP_SEDN                  0
2417
-    #define E5_COOLSTEP_SEIMIN                1
2418
-  #endif
2419
-
2420
-  #if AXIS_HAS_COOLSTEP(E6)
2421
-    #define E6_COOLSTEP_SPEED_THRESHOLD       5
2422
-    #define E6_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2423
-    #define E6_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2424
-    #define E6_COOLSTEP_SEUP                  2
2425
-    #define E6_COOLSTEP_SEDN                  0
2426
-    #define E6_COOLSTEP_SEIMIN                1
2427
-  #endif
2428
-
2429
-  #if AXIS_HAS_COOLSTEP(E7)
2430
-    #define E7_COOLSTEP_SPEED_THRESHOLD       5
2431
-    #define E7_COOLSTEP_LOWER_LOAD_THRESHOLD  7
2432
-    #define E7_COOLSTEP_UPPER_LOAD_THRESHOLD  0
2433
-    #define E7_COOLSTEP_SEUP                  2
2434
-    #define E7_COOLSTEP_SEDN                  0
2435
-    #define E7_COOLSTEP_SEIMIN                1
2436
-  #endif
2437
-
2438
-  /**
2439
    * Use StallGuard2 to home / probe X, Y, Z.
2279
    * Use StallGuard2 to home / probe X, Y, Z.
2440
    *
2280
    *
2441
    * TMC2130, TMC2160, TMC2209, TMC2660, TMC5130, and TMC5160 only
2281
    * TMC2130, TMC2160, TMC2209, TMC2660, TMC5130, and TMC5160 only

+ 1
- 15
Marlin/src/feature/tmc_util.h Целия файл

137
       #endif
137
       #endif
138
     #endif
138
     #endif
139
 
139
 
140
-    uint32_t get_cool_thrs() {
141
-      return _tmc_thrs(this->microsteps(), this->TCOOLTHRS(), planner.settings.axis_steps_per_mm[AXIS_ID]);
142
-    }
143
-    void set_cool_thrs(const uint32_t thrs) {
144
-      TMC::TCOOLTHRS(_tmc_thrs(this->microsteps(), thrs, planner.settings.axis_steps_per_mm[AXIS_ID]));
145
-    }
146
-
147
     #if HAS_LCD_MENU
140
     #if HAS_LCD_MENU
148
       inline void refresh_stepper_current() { rms_current(this->val_mA); }
141
       inline void refresh_stepper_current() { rms_current(this->val_mA); }
149
 
142
 
240
         #endif
233
         #endif
241
       }
234
       }
242
     #endif
235
     #endif
243
-
244
-    uint32_t get_cool_thrs() {
245
-      return _tmc_thrs(this->microsteps(), this->TCOOLTHRS(), planner.settings.axis_steps_per_mm[AXIS_ID]);
246
-    }
247
-    void set_cool_thrs(const uint32_t thrs) {
248
-      TMC2209Stepper::TCOOLTHRS(_tmc_thrs(this->microsteps(), thrs, planner.settings.axis_steps_per_mm[AXIS_ID]));
249
-    }
250
-
251
     #if USE_SENSORLESS
236
     #if USE_SENSORLESS
252
       inline int16_t homing_threshold() { return TMC2209Stepper::SGTHRS(); }
237
       inline int16_t homing_threshold() { return TMC2209Stepper::SGTHRS(); }
253
       void homing_threshold(int16_t sgt_val) {
238
       void homing_threshold(int16_t sgt_val) {
261
 
246
 
262
     #if HAS_LCD_MENU
247
     #if HAS_LCD_MENU
263
       inline void refresh_stepper_current() { rms_current(this->val_mA); }
248
       inline void refresh_stepper_current() { rms_current(this->val_mA); }
249
+
264
       #if ENABLED(HYBRID_THRESHOLD)
250
       #if ENABLED(HYBRID_THRESHOLD)
265
         inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
251
         inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
266
       #endif
252
       #endif

+ 0
- 56
Marlin/src/inc/SanityCheck.h Целия файл

2041
 #endif
2041
 #endif
2042
 
2042
 
2043
 /**
2043
 /**
2044
- * Make sure CoolStep settings exist
2045
- */
2046
-#if HAS_COOLSTEP
2047
-  #define NEEDS_COOLSTEP(A) AXIS_HAS_COOLSTEP(A) && !(defined(A##_COOLSTEP_SPEED_THRESHOLD) && defined(A##_COOLSTEP_LOWER_LOAD_THRESHOLD) && defined(A##_COOLSTEP_UPPER_LOAD_THRESHOLD) && defined(A##_COOLSTEP_SEUP) && defined(A##_COOLSTEP_SEDN) && defined(A##_COOLSTEP_SEIMIN))
2048
-  #if NEEDS_COOLSTEP(X)
2049
-    #error "X COOLSTEP settings must be defined in Configuration_adv.h."
2050
-  #endif
2051
-  #if NEEDS_COOLSTEP(X2)
2052
-    #error "X2 COOLSTEP settings must be defined in Configuration_adv.h."
2053
-  #endif
2054
-  #if NEEDS_COOLSTEP(Y)
2055
-    #error "Y COOLSTEP settings must be defined in Configuration_adv.h."
2056
-  #endif
2057
-  #if NEEDS_COOLSTEP(Y2)
2058
-    #error "Y2 COOLSTEP settings must be defined in Configuration_adv.h."
2059
-  #endif
2060
-  #if NEEDS_COOLSTEP(Z)
2061
-    #error "Z COOLSTEP settings must be defined in Configuration_adv.h."
2062
-  #endif
2063
-  #if NEEDS_COOLSTEP(Z2)
2064
-    #error "Z2 COOLSTEP settings must be defined in Configuration_adv.h."
2065
-  #endif
2066
-  #if NEEDS_COOLSTEP(Z3)
2067
-    #error "Z3 COOLSTEP settings must be defined in Configuration_adv.h."
2068
-  #endif
2069
-  #if NEEDS_COOLSTEP(Z4)
2070
-    #error "Z4 COOLSTEP settings must be defined in Configuration_adv.h."
2071
-  #endif
2072
-  #if NEEDS_COOLSTEP(E0)
2073
-    #error "E0 COOLSTEP settings must be defined in Configuration_adv.h."
2074
-  #endif
2075
-  #if NEEDS_COOLSTEP(E1)
2076
-    #error "E1 COOLSTEP settings must be defined in Configuration_adv.h."
2077
-  #endif
2078
-  #if NEEDS_COOLSTEP(E2)
2079
-    #error "E2 COOLSTEP settings must be defined in Configuration_adv.h."
2080
-  #endif
2081
-  #if NEEDS_COOLSTEP(E3)
2082
-    #error "E3 COOLSTEP settings must be defined in Configuration_adv.h."
2083
-  #endif
2084
-  #if NEEDS_COOLSTEP(E4)
2085
-    #error "E4 COOLSTEP settings must be defined in Configuration_adv.h."
2086
-  #endif
2087
-  #if NEEDS_COOLSTEP(E5)
2088
-    #error "E5 COOLSTEP settings must be defined in Configuration_adv.h."
2089
-  #endif
2090
-  #if NEEDS_COOLSTEP(E6)
2091
-    #error "E6 COOLSTEP settings must be defined in Configuration_adv.h."
2092
-  #endif
2093
-  #if NEEDS_COOLSTEP(E7)
2094
-    #error "E7 COOLSTEP settings must be defined in Configuration_adv.h."
2095
-  #endif
2096
-  #undef NEEDS_COOLSTEP
2097
-#endif
2098
-
2099
-/**
2100
  * Check existing CS pins against enabled TMC SPI drivers.
2044
  * Check existing CS pins against enabled TMC SPI drivers.
2101
  */
2045
  */
2102
 #define INVALID_TMC_SPI(ST) (AXIS_HAS_SPI(ST) && !PIN_EXISTS(ST##_CS))
2046
 #define INVALID_TMC_SPI(ST) (AXIS_HAS_SPI(ST) && !PIN_EXISTS(ST##_CS))

+ 8
- 121
Marlin/src/module/stepper/trinamic.cpp Целия файл

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_1(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS)
40
-#define _TMC_INIT_2(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, stealthchop_by_axis[STEALTH_INDEX], ST##_HYBRID_THRESHOLD)
41
-#define _TMC_INIT_3(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, stealthchop_by_axis[STEALTH_INDEX], ST##_HYBRID_THRESHOLD, ST##_COOLSTEP_SPEED_THRESHOLD, ST##_COOLSTEP_LOWER_LOAD_THRESHOLD, ST##_COOLSTEP_UPPER_LOAD_THRESHOLD, ST##_COOLSTEP_SEUP, ST##_COOLSTEP_SEDN, ST##_COOLSTEP_SEIMIN)
42
-#define _TMC_INIT_TMC2660(ST, STEALTH_INDEX) _TMC_INIT_1(ST, STEALTH_INDEX)
43
-#define _TMC_INIT_TMC2160(ST, STEALTH_INDEX) _TMC_INIT_2(ST, STEALTH_INDEX)
44
-#define _TMC_INIT_TMC2208(ST, STEALTH_INDEX) _TMC_INIT_2(ST, STEALTH_INDEX)
45
-#define _TMC_INIT_TMC5130(ST, STEALTH_INDEX) _TMC_INIT_3(ST, STEALTH_INDEX)
46
-#define _TMC_INIT_TMC5160(ST, STEALTH_INDEX) _TMC_INIT_3(ST, STEALTH_INDEX)
47
-#define _TMC_INIT_TMC2130(ST, STEALTH_INDEX) _TMC_INIT_3(ST, STEALTH_INDEX)
48
-#define _TMC_INIT_TMC2209(ST, STEALTH_INDEX) _TMC_INIT_3(ST, STEALTH_INDEX)
49
-#define __TMC_INIT(DRV, ST, STEALTH_INDEX) _TMC_INIT_##DRV(ST, STEALTH_INDEX)
50
-#define _TMC_INIT(DRV, ST, STEALTH_INDEX) __TMC_INIT(DRV, ST, STEALTH_INDEX)
51
-#define TMC_INIT(ST, STEALTH_INDEX) _TMC_INIT(ST##_DRIVER_TYPE, ST, STEALTH_INDEX)
39
+#define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX])
52
 
40
 
53
 //   IC = TMC model number
41
 //   IC = TMC model number
54
 //   ST = Stepper object letter
42
 //   ST = Stepper object letter
134
 
122
 
135
 #if HAS_DRIVER(TMC2130)
123
 #if HAS_DRIVER(TMC2130)
136
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
124
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
137
-  void tmc_init(
138
-    TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
139
-    const uint16_t mA,
140
-    const uint16_t microsteps,
141
-    const bool stealth,
142
-    const uint32_t hyb_thrs,
143
-    const uint32_t cool_thrs,
144
-    const uint8_t cool_semin,
145
-    const uint8_t cool_semax,
146
-    const uint8_t cool_seup,
147
-    const uint8_t cool_sedn,
148
-    const bool cool_seimin
149
-  ) {
125
+  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) {
150
     st.begin();
126
     st.begin();
151
 
127
 
152
     CHOPCONF_t chopconf{0};
128
     CHOPCONF_t chopconf{0};
181
       UNUSED(hyb_thrs);
157
       UNUSED(hyb_thrs);
182
     #endif
158
     #endif
183
 
159
 
184
-    st.set_cool_thrs(cool_thrs);  // (mm/s)
185
-    COOLCONF_t coolconf{0};
186
-    coolconf.semin = cool_semin;
187
-    coolconf.semax = cool_semax;
188
-    coolconf.seup = cool_seup;
189
-    coolconf.sedn = cool_sedn;
190
-    coolconf.seimin = cool_seimin;
191
-    st.COOLCONF(coolconf.sr);
192
-
193
     st.GSTAT(); // Clear GSTAT
160
     st.GSTAT(); // Clear GSTAT
194
   }
161
   }
195
 #endif // TMC2130
162
 #endif // TMC2130
196
 
163
 
197
 #if HAS_DRIVER(TMC2160)
164
 #if HAS_DRIVER(TMC2160)
198
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
165
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
199
-  void tmc_init(
200
-    TMCMarlin<TMC2160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
201
-    const uint16_t mA,
202
-    const uint16_t microsteps,
203
-    const bool stealth,
204
-    const uint32_t hyb_thrs
205
-  ) {
166
+  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) {
206
     st.begin();
167
     st.begin();
207
 
168
 
208
     CHOPCONF_t chopconf{0};
169
     CHOPCONF_t chopconf{0};
479
 
440
 
480
 #if HAS_DRIVER(TMC2208)
441
 #if HAS_DRIVER(TMC2208)
481
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
442
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
482
-  void tmc_init(
483
-    TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
484
-    const uint16_t mA,
485
-    const uint16_t microsteps,
486
-    const bool stealth,
487
-    const uint32_t hyb_thrs
488
-  ) {
443
+  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) {
489
     TMC2208_n::GCONF_t gconf{0};
444
     TMC2208_n::GCONF_t gconf{0};
490
     gconf.pdn_disable = true; // Use UART
445
     gconf.pdn_disable = true; // Use UART
491
     gconf.mstep_reg_select = true; // Select microsteps with UART
446
     gconf.mstep_reg_select = true; // Select microsteps with UART
533
 
488
 
534
 #if HAS_DRIVER(TMC2209)
489
 #if HAS_DRIVER(TMC2209)
535
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
490
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
536
-  void tmc_init(
537
-    TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
538
-    const uint16_t mA,
539
-    const uint16_t microsteps,
540
-    const bool stealth,
541
-    const uint32_t hyb_thrs,
542
-    const uint32_t cool_thrs,
543
-    const uint8_t cool_semin,
544
-    const uint8_t cool_semax,
545
-    const uint8_t cool_seup,
546
-    const uint8_t cool_sedn,
547
-    const bool cool_seimin
548
-  ) {
491
+  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) {
549
     TMC2208_n::GCONF_t gconf{0};
492
     TMC2208_n::GCONF_t gconf{0};
550
     gconf.pdn_disable = true; // Use UART
493
     gconf.pdn_disable = true; // Use UART
551
     gconf.mstep_reg_select = true; // Select microsteps with UART
494
     gconf.mstep_reg_select = true; // Select microsteps with UART
586
       UNUSED(hyb_thrs);
529
       UNUSED(hyb_thrs);
587
     #endif
530
     #endif
588
 
531
 
589
-    st.set_cool_thrs(cool_thrs);  // (mm/s)
590
-    COOLCONF_t coolconf{0};
591
-    coolconf.semin = cool_semin;
592
-    coolconf.semax = cool_semax;
593
-    coolconf.seup = cool_seup;
594
-    coolconf.sedn = cool_sedn;
595
-    coolconf.seimin = cool_seimin;
596
-    st.COOLCONF(coolconf.sr);
597
-
598
     st.GSTAT(0b111); // Clear
532
     st.GSTAT(0b111); // Clear
599
     delay(200);
533
     delay(200);
600
   }
534
   }
602
 
536
 
603
 #if HAS_DRIVER(TMC2660)
537
 #if HAS_DRIVER(TMC2660)
604
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
538
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
605
-  void tmc_init(
606
-    TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
607
-    const uint16_t mA,
608
-    const uint16_t microsteps
609
-  ) {
539
+  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) {
610
     st.begin();
540
     st.begin();
611
 
541
 
612
     TMC2660_n::CHOPCONF_t chopconf{0};
542
     TMC2660_n::CHOPCONF_t chopconf{0};
633
 
563
 
634
 #if HAS_DRIVER(TMC5130)
564
 #if HAS_DRIVER(TMC5130)
635
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
565
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
636
-  void tmc_init(
637
-    TMCMarlin<TMC5130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
638
-    const uint16_t mA,
639
-    const uint16_t microsteps,
640
-    const bool stealth,
641
-    const uint32_t hyb_thrs,
642
-    const uint32_t cool_thrs,
643
-    const uint8_t cool_semin,
644
-    const uint8_t cool_semax,
645
-    const uint8_t cool_seup,
646
-    const uint8_t cool_sedn,
647
-    const bool cool_seimin
648
-  ) {
566
+  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) {
649
     st.begin();
567
     st.begin();
650
 
568
 
651
     CHOPCONF_t chopconf{0};
569
     CHOPCONF_t chopconf{0};
680
       UNUSED(hyb_thrs);
598
       UNUSED(hyb_thrs);
681
     #endif
599
     #endif
682
 
600
 
683
-    st.set_cool_thrs(cool_thrs);  // (mm/s)
684
-    COOLCONF_t coolconf{0};
685
-    coolconf.semin = cool_semin;
686
-    coolconf.semax = cool_semax;
687
-    coolconf.seup = cool_seup;
688
-    coolconf.sedn = cool_sedn;
689
-    coolconf.seimin = cool_seimin;
690
-    st.COOLCONF(coolconf.sr);
691
-
692
     st.GSTAT(); // Clear GSTAT
601
     st.GSTAT(); // Clear GSTAT
693
   }
602
   }
694
 #endif // TMC5130
603
 #endif // TMC5130
695
 
604
 
696
 #if HAS_DRIVER(TMC5160)
605
 #if HAS_DRIVER(TMC5160)
697
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
606
   template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
698
-  void tmc_init(
699
-    TMCMarlin<TMC5160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
700
-    const uint16_t mA,
701
-    const uint16_t microsteps,
702
-    const bool stealth,
703
-    const uint32_t hyb_thrs,
704
-    const uint32_t cool_thrs,
705
-    const uint8_t cool_semin,
706
-    const uint8_t cool_semax,
707
-    const uint8_t cool_seup,
708
-    const uint8_t cool_sedn,
709
-    const bool cool_seimin
710
-  ) {
607
+  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) {
711
     st.begin();
608
     st.begin();
712
 
609
 
713
     CHOPCONF_t chopconf{0};
610
     CHOPCONF_t chopconf{0};
744
     #else
641
     #else
745
       UNUSED(hyb_thrs);
642
       UNUSED(hyb_thrs);
746
     #endif
643
     #endif
747
-
748
-    st.set_cool_thrs(cool_thrs);  // (mm/s)
749
-    COOLCONF_t coolconf{0};
750
-    coolconf.semin = cool_semin;
751
-    coolconf.semax = cool_semax;
752
-    coolconf.seup = cool_seup;
753
-    coolconf.sedn = cool_sedn;
754
-    coolconf.seimin = cool_seimin;
755
-    st.COOLCONF(coolconf.sr);
756
-
757
     st.GSTAT(); // Clear GSTAT
644
     st.GSTAT(); // Clear GSTAT
758
   }
645
   }
759
 #endif // TMC5160
646
 #endif // TMC5160

Loading…
Отказ
Запис