Distinct Chopper Timing settings (#19781)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
Jago Strong-Wright 2020-10-18 04:35:19 +01:00 committed by Scott Lahteine
parent 32ca42ead3
commit 9124f1d7c8
3 changed files with 135 additions and 53 deletions

View file

@ -2471,10 +2471,26 @@
* CHOPPER_PRUSAMK3_24V // Imported parameters from the official Průša firmware for MK3 (24V)
* CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9
*
* Define you own with
* Define your own with:
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
*/
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V // All axes (override below)
//#define CHOPPER_TIMING_X CHOPPER_DEFAULT_12V // For X Axes (override below)
//#define CHOPPER_TIMING_X2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Y CHOPPER_DEFAULT_12V // For Y Axes (override below)
//#define CHOPPER_TIMING_Y2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Z CHOPPER_DEFAULT_12V // For Z Axes (override below)
//#define CHOPPER_TIMING_Z2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Z3 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Z4 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E CHOPPER_DEFAULT_12V // For Extruders (override below)
//#define CHOPPER_TIMING_E1 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E3 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E4 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E5 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E6 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E7 CHOPPER_DEFAULT_12V
/**
* Monitor Trinamic drivers

View file

@ -36,7 +36,7 @@
#include <SPI.h>
enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX])
#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)
// IC = TMC model number
// ST = Stepper object letter
@ -131,15 +131,15 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2130)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
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) {
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) {
st.begin();
CHOPCONF_t chopconf{0};
chopconf.tbl = 1;
chopconf.toff = chopper_timing.toff;
chopconf.tbl = 0b01;
chopconf.toff = chop_init.toff;
chopconf.intpol = INTERPOLATE;
chopconf.hend = chopper_timing.hend + 3;
chopconf.hstrt = chopper_timing.hstrt - 1;
chopconf.hend = chop_init.hend + 3;
chopconf.hstrt = chop_init.hstrt - 1;
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
@ -166,15 +166,15 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2160)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
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) {
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) {
st.begin();
CHOPCONF_t chopconf{0};
chopconf.tbl = 1;
chopconf.toff = chopper_timing.toff;
chopconf.tbl = 0b01;
chopconf.toff = chop_init.toff;
chopconf.intpol = INTERPOLATE;
chopconf.hend = chopper_timing.hend + 3;
chopconf.hstrt = chopper_timing.hstrt - 1;
chopconf.hend = chop_init.hend + 3;
chopconf.hstrt = chop_init.hstrt - 1;
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
@ -484,7 +484,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2208)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
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) {
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) {
TMC2208_n::GCONF_t gconf{0};
gconf.pdn_disable = true; // Use UART
gconf.mstep_reg_select = true; // Select microsteps with UART
@ -495,10 +495,10 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
TMC2208_n::CHOPCONF_t chopconf{0};
chopconf.tbl = 0b01; // blank_time = 24
chopconf.toff = chopper_timing.toff;
chopconf.toff = chop_init.toff;
chopconf.intpol = INTERPOLATE;
chopconf.hend = chopper_timing.hend + 3;
chopconf.hstrt = chopper_timing.hstrt - 1;
chopconf.hend = chop_init.hend + 3;
chopconf.hstrt = chop_init.hstrt - 1;
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
@ -526,7 +526,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2209)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
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) {
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) {
TMC2208_n::GCONF_t gconf{0};
gconf.pdn_disable = true; // Use UART
gconf.mstep_reg_select = true; // Select microsteps with UART
@ -537,10 +537,10 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
TMC2208_n::CHOPCONF_t chopconf{0};
chopconf.tbl = 0b01; // blank_time = 24
chopconf.toff = chopper_timing.toff;
chopconf.toff = chop_init.toff;
chopconf.intpol = INTERPOLATE;
chopconf.hend = chopper_timing.hend + 3;
chopconf.hstrt = chopper_timing.hstrt - 1;
chopconf.hend = chop_init.hend + 3;
chopconf.hstrt = chop_init.hstrt - 1;
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
@ -568,14 +568,14 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2660)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
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) {
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) {
st.begin();
TMC2660_n::CHOPCONF_t chopconf{0};
chopconf.tbl = 1;
chopconf.toff = chopper_timing.toff;
chopconf.hend = chopper_timing.hend + 3;
chopconf.hstrt = chopper_timing.hstrt - 1;
chopconf.tbl = 0b01;
chopconf.toff = chop_init.toff;
chopconf.hend = chop_init.hend + 3;
chopconf.hstrt = chop_init.hstrt - 1;
st.CHOPCONF(chopconf.sr);
st.sdoff(0);
@ -590,15 +590,15 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC5130)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
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) {
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) {
st.begin();
CHOPCONF_t chopconf{0};
chopconf.tbl = 1;
chopconf.toff = chopper_timing.toff;
chopconf.tbl = 0b01;
chopconf.toff = chop_init.toff;
chopconf.intpol = INTERPOLATE;
chopconf.hend = chopper_timing.hend + 3;
chopconf.hstrt = chopper_timing.hstrt - 1;
chopconf.hend = chop_init.hend + 3;
chopconf.hstrt = chop_init.hstrt - 1;
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
@ -625,15 +625,15 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC5160)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
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) {
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) {
st.begin();
CHOPCONF_t chopconf{0};
chopconf.tbl = 1;
chopconf.toff = chopper_timing.toff;
chopconf.tbl = 0b01;
chopconf.toff = chop_init.toff;
chopconf.intpol = INTERPOLATE;
chopconf.hend = chopper_timing.hend + 3;
chopconf.hstrt = chopper_timing.hstrt - 1;
chopconf.hend = chop_init.hend + 3;
chopconf.hstrt = chop_init.hstrt - 1;
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);

View file

@ -76,7 +76,18 @@ typedef struct {
uint8_t hstrt;
} chopper_timing_t;
static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING;
#ifndef CHOPPER_TIMING_X
#define CHOPPER_TIMING_X CHOPPER_TIMING
#endif
#ifndef CHOPPER_TIMING_Y
#define CHOPPER_TIMING_Y CHOPPER_TIMING
#endif
#ifndef CHOPPER_TIMING_Z
#define CHOPPER_TIMING_Z CHOPPER_TIMING
#endif
#ifndef CHOPPER_TIMING_E
#define CHOPPER_TIMING_E CHOPPER_TIMING
#endif
#if HAS_TMC220x
void tmc_serial_begin();
@ -90,9 +101,10 @@ void reset_trinamic_drivers();
// X Stepper
#if AXIS_IS_TMC(X)
extern TMC_CLASS(X, X) stepperX;
static constexpr chopper_timing_t chopper_timing_X = CHOPPER_TIMING_X;
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
#define X_ENABLE_INIT() NOOP
#define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
#define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing_X.toff : 0)
#define X_ENABLE_READ() stepperX.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(X)
@ -103,9 +115,10 @@ void reset_trinamic_drivers();
// Y Stepper
#if AXIS_IS_TMC(Y)
extern TMC_CLASS(Y, Y) stepperY;
static constexpr chopper_timing_t chopper_timing_Y = CHOPPER_TIMING_Y;
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
#define Y_ENABLE_INIT() NOOP
#define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
#define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y.toff : 0)
#define Y_ENABLE_READ() stepperY.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(Y)
@ -116,9 +129,10 @@ void reset_trinamic_drivers();
// Z Stepper
#if AXIS_IS_TMC(Z)
extern TMC_CLASS(Z, Z) stepperZ;
static constexpr chopper_timing_t chopper_timing_Z = CHOPPER_TIMING_Z;
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
#define Z_ENABLE_INIT() NOOP
#define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
#define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z.toff : 0)
#define Z_ENABLE_READ() stepperZ.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(Z)
@ -129,9 +143,13 @@ void reset_trinamic_drivers();
// X2 Stepper
#if HAS_X2_ENABLE && AXIS_IS_TMC(X2)
extern TMC_CLASS(X2, X) stepperX2;
#ifndef CHOPPER_TIMING_X2
#define CHOPPER_TIMING_X2 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_X2 = CHOPPER_TIMING_X2;
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
#define X2_ENABLE_INIT() NOOP
#define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
#define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing_X2.toff : 0)
#define X2_ENABLE_READ() stepperX2.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(X2)
@ -142,9 +160,13 @@ void reset_trinamic_drivers();
// Y2 Stepper
#if HAS_Y2_ENABLE && AXIS_IS_TMC(Y2)
extern TMC_CLASS(Y2, Y) stepperY2;
#ifndef CHOPPER_TIMING_Y2
#define CHOPPER_TIMING_Y2 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_Y2 = CHOPPER_TIMING_Y2;
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
#define Y2_ENABLE_INIT() NOOP
#define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
#define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y2.toff : 0)
#define Y2_ENABLE_READ() stepperY2.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(Y2)
@ -155,9 +177,13 @@ void reset_trinamic_drivers();
// Z2 Stepper
#if HAS_Z2_ENABLE && AXIS_IS_TMC(Z2)
extern TMC_CLASS(Z2, Z) stepperZ2;
#ifndef CHOPPER_TIMING_Z2
#define CHOPPER_TIMING_Z2 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_Z2 = CHOPPER_TIMING_Z2;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)
#define Z2_ENABLE_INIT() NOOP
#define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
#define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z2.toff : 0)
#define Z2_ENABLE_READ() stepperZ2.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(Z2)
@ -168,9 +194,13 @@ void reset_trinamic_drivers();
// Z3 Stepper
#if HAS_Z3_ENABLE && AXIS_IS_TMC(Z3)
extern TMC_CLASS(Z3, Z) stepperZ3;
#ifndef CHOPPER_TIMING_Z3
#define CHOPPER_TIMING_Z3 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_Z3 = CHOPPER_TIMING_Z3;
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
#define Z3_ENABLE_INIT() NOOP
#define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
#define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z3.toff : 0)
#define Z3_ENABLE_READ() stepperZ3.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(Z3)
@ -181,9 +211,13 @@ void reset_trinamic_drivers();
// Z4 Stepper
#if HAS_Z4_ENABLE && AXIS_IS_TMC(Z4)
extern TMC_CLASS(Z4, Z) stepperZ4;
#ifndef CHOPPER_TIMING_Z4
#define CHOPPER_TIMING_Z4 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_Z4 = CHOPPER_TIMING_Z4;
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
#define Z4_ENABLE_INIT() NOOP
#define Z4_ENABLE_WRITE(STATE) stepperZ4.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
#define Z4_ENABLE_WRITE(STATE) stepperZ4.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z4.toff : 0)
#define Z4_ENABLE_READ() stepperZ4.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(Z4)
@ -194,9 +228,13 @@ void reset_trinamic_drivers();
// E0 Stepper
#if AXIS_IS_TMC(E0)
extern TMC_CLASS_E(0) stepperE0;
#ifndef CHOPPER_TIMING_E0
#define CHOPPER_TIMING_E0 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_E0 = CHOPPER_TIMING_E0;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)
#define E0_ENABLE_INIT() NOOP
#define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing_E0.toff : 0)
#define E0_ENABLE_READ() stepperE0.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(E0)
@ -207,9 +245,13 @@ void reset_trinamic_drivers();
// E1 Stepper
#if AXIS_IS_TMC(E1)
extern TMC_CLASS_E(1) stepperE1;
#ifndef CHOPPER_TIMING_E1
#define CHOPPER_TIMING_E1 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_E1 = CHOPPER_TIMING_E1;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)
#define E1_ENABLE_INIT() NOOP
#define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing_E1.toff : 0)
#define E1_ENABLE_READ() stepperE1.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(E1)
@ -220,9 +262,13 @@ void reset_trinamic_drivers();
// E2 Stepper
#if AXIS_IS_TMC(E2)
extern TMC_CLASS_E(2) stepperE2;
#ifndef CHOPPER_TIMING_E2
#define CHOPPER_TIMING_E2 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_E2 = CHOPPER_TIMING_E2;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)
#define E2_ENABLE_INIT() NOOP
#define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing_E2.toff : 0)
#define E2_ENABLE_READ() stepperE2.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(E2)
@ -233,9 +279,13 @@ void reset_trinamic_drivers();
// E3 Stepper
#if AXIS_IS_TMC(E3)
extern TMC_CLASS_E(3) stepperE3;
#ifndef CHOPPER_TIMING_E3
#define CHOPPER_TIMING_E3 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_E3 = CHOPPER_TIMING_E3;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)
#define E3_ENABLE_INIT() NOOP
#define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing_E3.toff : 0)
#define E3_ENABLE_READ() stepperE3.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(E3)
@ -246,9 +296,13 @@ void reset_trinamic_drivers();
// E4 Stepper
#if AXIS_IS_TMC(E4)
extern TMC_CLASS_E(4) stepperE4;
#ifndef CHOPPER_TIMING_E4
#define CHOPPER_TIMING_E4 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_E4 = CHOPPER_TIMING_E4;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)
#define E4_ENABLE_INIT() NOOP
#define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing_E4.toff : 0)
#define E4_ENABLE_READ() stepperE4.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(E4)
@ -259,9 +313,13 @@ void reset_trinamic_drivers();
// E5 Stepper
#if AXIS_IS_TMC(E5)
extern TMC_CLASS_E(5) stepperE5;
#ifndef CHOPPER_TIMING_E5
#define CHOPPER_TIMING_E5 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_E5 = CHOPPER_TIMING_E5;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)
#define E5_ENABLE_INIT() NOOP
#define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing_E5.toff : 0)
#define E5_ENABLE_READ() stepperE5.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(E5)
@ -272,9 +330,13 @@ void reset_trinamic_drivers();
// E6 Stepper
#if AXIS_IS_TMC(E6)
extern TMC_CLASS_E(6) stepperE6;
#ifndef CHOPPER_TIMING_E6
#define CHOPPER_TIMING_E6 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_E6 = CHOPPER_TIMING_E6;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E6)
#define E6_ENABLE_INIT() NOOP
#define E6_ENABLE_WRITE(STATE) stepperE6.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E6_ENABLE_WRITE(STATE) stepperE6.toff((STATE)==E_ENABLE_ON ? chopper_timing_E6.toff : 0)
#define E6_ENABLE_READ() stepperE6.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(E6)
@ -285,9 +347,13 @@ void reset_trinamic_drivers();
// E7 Stepper
#if AXIS_IS_TMC(E7)
extern TMC_CLASS_E(7) stepperE7;
#ifndef CHOPPER_TIMING_E7
#define CHOPPER_TIMING_E7 CHOPPER_TIMING_E
#endif
static constexpr chopper_timing_t chopper_timing_E7 = CHOPPER_TIMING_E7;
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E7)
#define E7_ENABLE_INIT() NOOP
#define E7_ENABLE_WRITE(STATE) stepperE7.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E7_ENABLE_WRITE(STATE) stepperE7.toff((STATE)==E_ENABLE_ON ? chopper_timing_E7.toff : 0)
#define E7_ENABLE_READ() stepperE7.isEnabled()
#endif
#if AXIS_HAS_SQUARE_WAVE(E7)