Apply TERN to compact code (#17619)
This commit is contained in:
@ -33,21 +33,13 @@
|
||||
#include "indirection.h"
|
||||
|
||||
void restore_stepper_drivers() {
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
restore_trinamic_drivers();
|
||||
#endif
|
||||
TERN_(HAS_TRINAMIC_CONFIG, restore_trinamic_drivers());
|
||||
}
|
||||
|
||||
void reset_stepper_drivers() {
|
||||
#if HAS_DRIVER(TMC26X)
|
||||
tmc26x_init_to_defaults();
|
||||
#endif
|
||||
|
||||
#if HAS_L64XX
|
||||
L64xxManager.init_to_defaults();
|
||||
#endif
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
reset_trinamic_drivers();
|
||||
#endif
|
||||
TERN_(HAS_L64XX, L64xxManager.init_to_defaults());
|
||||
TERN_(HAS_TRINAMIC_CONFIG, reset_trinamic_drivers());
|
||||
}
|
||||
|
@ -140,9 +140,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@ -181,9 +179,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@ -475,9 +471,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@ -523,9 +517,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@ -569,15 +561,10 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
st.sdoff(0);
|
||||
st.rms_current(mA);
|
||||
st.microsteps(microsteps);
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
st.dedge(true);
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, st.dedge(true));
|
||||
st.intpol(INTERPOLATE);
|
||||
st.diss2g(true); // Disable short to ground protection. Too many false readings?
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
st.rdsel(0b01);
|
||||
#endif
|
||||
TERN_(TMC_DEBUG, st.rdsel(0b01));
|
||||
}
|
||||
#endif // TMC2660
|
||||
|
||||
@ -592,9 +579,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@ -633,9 +618,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
|
Reference in New Issue
Block a user