🎨 Apply _TERN where possible

This commit is contained in:
Scott Lahteine
2022-03-22 19:17:12 -05:00
committed by Scott Lahteine
parent 10a0c9a9b3
commit ced0ad8e09
5 changed files with 57 additions and 158 deletions

View File

@ -82,15 +82,13 @@
#if ENABLED(SENSORLESS_HOMING)
sensorless_t stealth_states {
LINEAR_AXIS_LIST(tmc_enable_stallguard(stepperX), tmc_enable_stallguard(stepperY), false, false, false, false)
, false
#if AXIS_HAS_STALLGUARD(X2)
|| tmc_enable_stallguard(stepperX2)
#endif
, false
#if AXIS_HAS_STALLGUARD(Y2)
|| tmc_enable_stallguard(stepperY2)
#endif
LINEAR_AXIS_LIST(
TERN0(X_SENSORLESS, tmc_enable_stallguard(stepperX)),
TERN0(Y_SENSORLESS, tmc_enable_stallguard(stepperY)),
false, false, false, false
)
, TERN0(X2_SENSORLESS, tmc_enable_stallguard(stepperX2))
, TERN0(Y2_SENSORLESS, tmc_enable_stallguard(stepperY2))
};
#endif
@ -101,14 +99,10 @@
current_position.set(0.0, 0.0);
#if ENABLED(SENSORLESS_HOMING) && DISABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
tmc_disable_stallguard(stepperX, stealth_states.x);
tmc_disable_stallguard(stepperY, stealth_states.y);
#if AXIS_HAS_STALLGUARD(X2)
tmc_disable_stallguard(stepperX2, stealth_states.x2);
#endif
#if AXIS_HAS_STALLGUARD(Y2)
tmc_disable_stallguard(stepperY2, stealth_states.y2);
#endif
TERN_(X_SENSORLESS, tmc_disable_stallguard(stepperX, stealth_states.x));
TERN_(X2_SENSORLESS, tmc_disable_stallguard(stepperX2, stealth_states.x2));
TERN_(Y_SENSORLESS, tmc_disable_stallguard(stepperY, stealth_states.y));
TERN_(Y2_SENSORLESS, tmc_disable_stallguard(stepperY2, stealth_states.y2));
#endif
}