🔧 Merge TMC26X with TMC config (#24373)

This commit is contained in:
Manuel McLure
2022-11-26 18:30:59 -08:00
committed by Scott Lahteine
parent 6185b50dbe
commit 360e03797f
7 changed files with 74 additions and 192 deletions

View File

@ -125,6 +125,8 @@
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) || AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_IS_TMC_CONFIG(A) ( AXIS_IS_TMC(A) || AXIS_DRIVER_TYPE(A,TMC26X) )
// Test for a driver that uses SPI - this allows checking whether a _CS_ pin
// is considered sensitive
#define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) || AXIS_DRIVER_TYPE(A,TMC2160) \

View File

@ -36,6 +36,8 @@ struct IF { typedef R type; };
template <class L, class R>
struct IF<true, L, R> { typedef L type; };
#define ALL_AXIS_NAMES X, X2, Y, Y2, Z, Z2, Z3, Z4, I, J, K, U, V, W, E0, E1, E2, E3, E4, E5, E6, E7
#define NUM_AXIS_GANG(V...) GANG_N(NUM_AXES, V)
#define NUM_AXIS_CODE(V...) CODE_N(NUM_AXES, V)
#define NUM_AXIS_LIST(V...) LIST_N(NUM_AXES, V)

View File

@ -994,8 +994,8 @@
#undef CALIBRATION_MEASURE_IMIN
#undef CALIBRATION_MEASURE_IMAX
#if NUM_AXES < 3
#undef Z_IDLE_HEIGHT
#undef STEALTHCHOP_Z
#undef Z_IDLE_HEIGHT
#undef Z_PROBE_SLED
#undef Z_SAFE_HOMING
#undef HOME_Z_FIRST
@ -1005,6 +1005,7 @@
#undef CNC_WORKSPACE_PLANES
#if NUM_AXES < 2
#undef STEALTHCHOP_Y
#undef QUICK_HOME
#endif
#endif
#endif

View File

@ -681,6 +681,17 @@
constexpr float arm[] = AXIS_RELATIVE_MODES;
static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _LOGICAL_AXES_STR "elements.");
// Consolidate TMC26X, validate migration (#24373)
#define _ISMAX_1(A) defined(A##_MAX_CURRENT)
#define _ISSNS_1(A) defined(A##_SENSE_RESISTOR)
#if DO(ISMAX,||,ALL_AXIS_NAMES)
#error "*_MAX_CURRENT is now set with *_CURRENT."
#elif DO(ISSNS,||,ALL_AXIS_NAMES)
#error "*_SENSE_RESISTOR (in Milli-Ohms) is now set with *_RSENSE (in Ohms), so you must divide values by 1000."
#endif
#undef _ISMAX_1
#undef _ISSNS_1
/**
* Probe temp compensation requirements
*/

View File

@ -34,7 +34,7 @@
#include "TMC26X.h"
#define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_CS_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR)
#define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_CS_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_CURRENT, int(ST##_RSENSE * 1000))
#if AXIS_DRIVER_TYPE_X(TMC26X)
_TMC26X_DEFINE(X);

View File

@ -1023,8 +1023,6 @@ void reset_trinamic_drivers() {
// 2. For each axis in use, static_assert using a constexpr function, which counts the
// number of matching/conflicting axis. If the value is not exactly 1, fail.
#define ALL_AXIS_NAMES X, X2, Y, Y2, Z, Z2, Z3, Z4, I, J, K, U, V, W, E0, E1, E2, E3, E4, E5, E6, E7
#if ANY_AXIS_HAS(HW_SERIAL)
// Hardware serial names are compared as strings, since actually resolving them cannot occur in a constexpr.
// Using a fixed-length character array for the port name allows this to be constexpr compatible.