|
@@ -36,7 +36,7 @@
|
36
|
36
|
#include <SPI.h>
|
37
|
37
|
|
38
|
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
|
41
|
// IC = TMC model number
|
42
|
42
|
// ST = Stepper object letter
|
|
@@ -131,13 +131,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
131
|
131
|
|
132
|
132
|
#if HAS_DRIVER(TMC2130)
|
133
|
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
|
135
|
st.begin();
|
136
|
136
|
|
137
|
137
|
CHOPCONF_t chopconf{0};
|
138
|
138
|
chopconf.tbl = 0b01;
|
139
|
139
|
chopconf.toff = chop_init.toff;
|
140
|
|
- chopconf.intpol = INTERPOLATE;
|
|
140
|
+ chopconf.intpol = interpolate;
|
141
|
141
|
chopconf.hend = chop_init.hend + 3;
|
142
|
142
|
chopconf.hstrt = chop_init.hstrt - 1;
|
143
|
143
|
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
|
@@ -166,13 +166,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
166
|
166
|
|
167
|
167
|
#if HAS_DRIVER(TMC2160)
|
168
|
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
|
170
|
st.begin();
|
171
|
171
|
|
172
|
172
|
CHOPCONF_t chopconf{0};
|
173
|
173
|
chopconf.tbl = 0b01;
|
174
|
174
|
chopconf.toff = chop_init.toff;
|
175
|
|
- chopconf.intpol = INTERPOLATE;
|
|
175
|
+ chopconf.intpol = interpolate;
|
176
|
176
|
chopconf.hend = chop_init.hend + 3;
|
177
|
177
|
chopconf.hstrt = chop_init.hstrt - 1;
|
178
|
178
|
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
|
@@ -484,7 +484,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
484
|
484
|
|
485
|
485
|
#if HAS_DRIVER(TMC2208)
|
486
|
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
|
488
|
TMC2208_n::GCONF_t gconf{0};
|
489
|
489
|
gconf.pdn_disable = true; // Use UART
|
490
|
490
|
gconf.mstep_reg_select = true; // Select microsteps with UART
|
|
@@ -496,7 +496,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
496
|
496
|
TMC2208_n::CHOPCONF_t chopconf{0};
|
497
|
497
|
chopconf.tbl = 0b01; // blank_time = 24
|
498
|
498
|
chopconf.toff = chop_init.toff;
|
499
|
|
- chopconf.intpol = INTERPOLATE;
|
|
499
|
+ chopconf.intpol = interpolate;
|
500
|
500
|
chopconf.hend = chop_init.hend + 3;
|
501
|
501
|
chopconf.hstrt = chop_init.hstrt - 1;
|
502
|
502
|
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
|
@@ -526,7 +526,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
526
|
526
|
|
527
|
527
|
#if HAS_DRIVER(TMC2209)
|
528
|
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
|
530
|
TMC2208_n::GCONF_t gconf{0};
|
531
|
531
|
gconf.pdn_disable = true; // Use UART
|
532
|
532
|
gconf.mstep_reg_select = true; // Select microsteps with UART
|
|
@@ -538,7 +538,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
538
|
538
|
TMC2208_n::CHOPCONF_t chopconf{0};
|
539
|
539
|
chopconf.tbl = 0b01; // blank_time = 24
|
540
|
540
|
chopconf.toff = chop_init.toff;
|
541
|
|
- chopconf.intpol = INTERPOLATE;
|
|
541
|
+ chopconf.intpol = interpolate;
|
542
|
542
|
chopconf.hend = chop_init.hend + 3;
|
543
|
543
|
chopconf.hstrt = chop_init.hstrt - 1;
|
544
|
544
|
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
|
@@ -568,7 +568,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
568
|
568
|
|
569
|
569
|
#if HAS_DRIVER(TMC2660)
|
570
|
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
|
572
|
st.begin();
|
573
|
573
|
|
574
|
574
|
TMC2660_n::CHOPCONF_t chopconf{0};
|
|
@@ -582,7 +582,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
582
|
582
|
st.rms_current(mA);
|
583
|
583
|
st.microsteps(microsteps);
|
584
|
584
|
TERN_(SQUARE_WAVE_STEPPING, st.dedge(true));
|
585
|
|
- st.intpol(INTERPOLATE);
|
|
585
|
+ st.intpol(interpolate);
|
586
|
586
|
st.diss2g(true); // Disable short to ground protection. Too many false readings?
|
587
|
587
|
TERN_(TMC_DEBUG, st.rdsel(0b01));
|
588
|
588
|
}
|
|
@@ -590,13 +590,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
590
|
590
|
|
591
|
591
|
#if HAS_DRIVER(TMC5130)
|
592
|
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
|
594
|
st.begin();
|
595
|
595
|
|
596
|
596
|
CHOPCONF_t chopconf{0};
|
597
|
597
|
chopconf.tbl = 0b01;
|
598
|
598
|
chopconf.toff = chop_init.toff;
|
599
|
|
- chopconf.intpol = INTERPOLATE;
|
|
599
|
+ chopconf.intpol = interpolate;
|
600
|
600
|
chopconf.hend = chop_init.hend + 3;
|
601
|
601
|
chopconf.hstrt = chop_init.hstrt - 1;
|
602
|
602
|
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
|
@@ -625,13 +625,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
625
|
625
|
|
626
|
626
|
#if HAS_DRIVER(TMC5160)
|
627
|
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
|
629
|
st.begin();
|
630
|
630
|
|
631
|
631
|
CHOPCONF_t chopconf{0};
|
632
|
632
|
chopconf.tbl = 0b01;
|
633
|
633
|
chopconf.toff = chop_init.toff;
|
634
|
|
- chopconf.intpol = INTERPOLATE;
|
|
634
|
+ chopconf.intpol = interpolate;
|
635
|
635
|
chopconf.hend = chop_init.hend + 3;
|
636
|
636
|
chopconf.hstrt = chop_init.hstrt - 1;
|
637
|
637
|
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|