3636#include < SPI.h>
3737
3838enum 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 )
4040
4141// IC = TMC model number
4242// ST = Stepper object letter
@@ -131,13 +131,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
131131
132132#if HAS_DRIVER(TMC2130)
133133 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 ) {
135135 st.begin ();
136136
137137 CHOPCONF_t chopconf{0 };
138138 chopconf.tbl = 0b01 ;
139139 chopconf.toff = chop_init.toff ;
140- chopconf.intpol = INTERPOLATE ;
140+ chopconf.intpol = interpolate ;
141141 chopconf.hend = chop_init.hend + 3 ;
142142 chopconf.hstrt = chop_init.hstrt - 1 ;
143143 TERN_ (SQUARE_WAVE_STEPPING, chopconf.dedge = true );
@@ -166,13 +166,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
166166
167167#if HAS_DRIVER(TMC2160)
168168 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 ) {
170170 st.begin ();
171171
172172 CHOPCONF_t chopconf{0 };
173173 chopconf.tbl = 0b01 ;
174174 chopconf.toff = chop_init.toff ;
175- chopconf.intpol = INTERPOLATE ;
175+ chopconf.intpol = interpolate ;
176176 chopconf.hend = chop_init.hend + 3 ;
177177 chopconf.hstrt = chop_init.hstrt - 1 ;
178178 TERN_ (SQUARE_WAVE_STEPPING, chopconf.dedge = true );
@@ -484,7 +484,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
484484
485485#if HAS_DRIVER(TMC2208)
486486 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 ) {
488488 TMC2208_n::GCONF_t gconf{0 };
489489 gconf.pdn_disable = true ; // Use UART
490490 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 };
496496 TMC2208_n::CHOPCONF_t chopconf{0 };
497497 chopconf.tbl = 0b01 ; // blank_time = 24
498498 chopconf.toff = chop_init.toff ;
499- chopconf.intpol = INTERPOLATE ;
499+ chopconf.intpol = interpolate ;
500500 chopconf.hend = chop_init.hend + 3 ;
501501 chopconf.hstrt = chop_init.hstrt - 1 ;
502502 TERN_ (SQUARE_WAVE_STEPPING, chopconf.dedge = true );
@@ -526,7 +526,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
526526
527527#if HAS_DRIVER(TMC2209)
528528 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 ) {
530530 TMC2208_n::GCONF_t gconf{0 };
531531 gconf.pdn_disable = true ; // Use UART
532532 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 };
538538 TMC2208_n::CHOPCONF_t chopconf{0 };
539539 chopconf.tbl = 0b01 ; // blank_time = 24
540540 chopconf.toff = chop_init.toff ;
541- chopconf.intpol = INTERPOLATE ;
541+ chopconf.intpol = interpolate ;
542542 chopconf.hend = chop_init.hend + 3 ;
543543 chopconf.hstrt = chop_init.hstrt - 1 ;
544544 TERN_ (SQUARE_WAVE_STEPPING, chopconf.dedge = true );
@@ -568,7 +568,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
568568
569569#if HAS_DRIVER(TMC2660)
570570 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 ) {
572572 st.begin ();
573573
574574 TMC2660_n::CHOPCONF_t chopconf{0 };
@@ -582,21 +582,21 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
582582 st.rms_current (mA );
583583 st.microsteps (microsteps);
584584 TERN_ (SQUARE_WAVE_STEPPING, st.dedge (true ));
585- st.intpol (INTERPOLATE );
585+ st.intpol (interpolate );
586586 st.diss2g (true ); // Disable short to ground protection. Too many false readings?
587587 TERN_ (TMC_DEBUG, st.rdsel (0b01 ));
588588 }
589589#endif // TMC2660
590590
591591#if HAS_DRIVER(TMC5130)
592592 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 ) {
594594 st.begin ();
595595
596596 CHOPCONF_t chopconf{0 };
597597 chopconf.tbl = 0b01 ;
598598 chopconf.toff = chop_init.toff ;
599- chopconf.intpol = INTERPOLATE ;
599+ chopconf.intpol = interpolate ;
600600 chopconf.hend = chop_init.hend + 3 ;
601601 chopconf.hstrt = chop_init.hstrt - 1 ;
602602 TERN_ (SQUARE_WAVE_STEPPING, chopconf.dedge = true );
@@ -625,13 +625,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
625625
626626#if HAS_DRIVER(TMC5160)
627627 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 ) {
629629 st.begin ();
630630
631631 CHOPCONF_t chopconf{0 };
632632 chopconf.tbl = 0b01 ;
633633 chopconf.toff = chop_init.toff ;
634- chopconf.intpol = INTERPOLATE ;
634+ chopconf.intpol = interpolate ;
635635 chopconf.hend = chop_init.hend + 3 ;
636636 chopconf.hstrt = chop_init.hstrt - 1 ;
637637 TERN_ (SQUARE_WAVE_STEPPING, chopconf.dedge = true );
0 commit comments