✨ Support for up to 9 axes (linear, rotary) (#23112)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@@ -221,6 +221,15 @@
|
||||
#if !AXIS_HAS_SPI(K)
|
||||
#undef K_CS_PIN
|
||||
#endif
|
||||
#if !AXIS_HAS_SPI(U)
|
||||
#undef U_CS_PIN
|
||||
#endif
|
||||
#if !AXIS_HAS_SPI(V)
|
||||
#undef V_CS_PIN
|
||||
#endif
|
||||
#if !AXIS_HAS_SPI(W)
|
||||
#undef W_CS_PIN
|
||||
#endif
|
||||
#if E_STEPPERS && !AXIS_HAS_SPI(E0)
|
||||
#undef E0_CS_PIN
|
||||
#endif
|
||||
@@ -264,6 +273,15 @@
|
||||
#ifndef K_CS_PIN
|
||||
#define K_CS_PIN -1
|
||||
#endif
|
||||
#ifndef U_CS_PIN
|
||||
#define U_CS_PIN -1
|
||||
#endif
|
||||
#ifndef V_CS_PIN
|
||||
#define V_CS_PIN -1
|
||||
#endif
|
||||
#ifndef W_CS_PIN
|
||||
#define W_CS_PIN -1
|
||||
#endif
|
||||
#ifndef E0_CS_PIN
|
||||
#define E0_CS_PIN -1
|
||||
#endif
|
||||
@@ -546,6 +564,75 @@
|
||||
#undef K_MAX_PIN
|
||||
#endif
|
||||
|
||||
#if HAS_U_AXIS
|
||||
#ifdef U_STOP_PIN
|
||||
#if U_HOME_TO_MIN
|
||||
#define U_MIN_PIN U_STOP_PIN
|
||||
#ifndef U_MAX_PIN
|
||||
#define U_MAX_PIN -1
|
||||
#endif
|
||||
#else
|
||||
#define U_MAX_PIN U_STOP_PIN
|
||||
#ifndef U_MIN_PIN
|
||||
#define U_MIN_PIN -1
|
||||
#endif
|
||||
#endif
|
||||
#elif U_HOME_TO_MIN
|
||||
#define U_STOP_PIN U_MIN_PIN
|
||||
#else
|
||||
#define U_STOP_PIN U_MAX_PIN
|
||||
#endif
|
||||
#else
|
||||
#undef U_MIN_PIN
|
||||
#undef U_MAX_PIN
|
||||
#endif
|
||||
|
||||
#if HAS_V_AXIS
|
||||
#ifdef V_STOP_PIN
|
||||
#if V_HOME_TO_MIN
|
||||
#define V_MIN_PIN V_STOP_PIN
|
||||
#ifndef V_MAX_PIN
|
||||
#define V_MAX_PIN -1
|
||||
#endif
|
||||
#else
|
||||
#define V_MAX_PIN V_STOP_PIN
|
||||
#ifndef V_MIN_PIN
|
||||
#define V_MIN_PIN -1
|
||||
#endif
|
||||
#endif
|
||||
#elif V_HOME_TO_MIN
|
||||
#define V_STOP_PIN V_MIN_PIN
|
||||
#else
|
||||
#define V_STOP_PIN V_MAX_PIN
|
||||
#endif
|
||||
#else
|
||||
#undef V_MIN_PIN
|
||||
#undef V_MAX_PIN
|
||||
#endif
|
||||
|
||||
#if HAS_W_AXIS
|
||||
#ifdef W_STOP_PIN
|
||||
#if W_HOME_TO_MIN
|
||||
#define W_MIN_PIN W_STOP_PIN
|
||||
#ifndef W_MAX_PIN
|
||||
#define W_MAX_PIN -1
|
||||
#endif
|
||||
#else
|
||||
#define W_MAX_PIN W_STOP_PIN
|
||||
#ifndef W_MIN_PIN
|
||||
#define W_MIN_PIN -1
|
||||
#endif
|
||||
#endif
|
||||
#elif W_HOME_TO_MIN
|
||||
#define W_STOP_PIN W_MIN_PIN
|
||||
#else
|
||||
#define W_STOP_PIN W_MAX_PIN
|
||||
#endif
|
||||
#else
|
||||
#undef W_MIN_PIN
|
||||
#undef W_MAX_PIN
|
||||
#endif
|
||||
|
||||
// Filament Sensor first pin alias
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN // Filament Sensor first pin alias
|
||||
@@ -1204,6 +1291,12 @@
|
||||
#define J_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
#if HAS_K_AXIS && !defined(K_DIAG_PIN) && !defined(K_STEP_PIN) && !PIN_EXISTS(K_CS_PIN)
|
||||
#define U_E_INDEX INCREMENT(K_E_INDEX)
|
||||
#else
|
||||
#define U_E_INDEX K_E_INDEX
|
||||
#endif
|
||||
|
||||
// The K axis, if any, should be the next open extruder port
|
||||
#if HAS_K_AXIS
|
||||
#ifndef K_STEP_PIN
|
||||
@@ -1284,6 +1377,258 @@
|
||||
#define K_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
#if HAS_U_AXIS && !defined(U_DIAG_PIN) && !defined(U_STEP_PIN) && !PIN_EXISTS(U_CS_PIN)
|
||||
#define V_E_INDEX INCREMENT(U_E_INDEX)
|
||||
#else
|
||||
#define V_E_INDEX U_E_INDEX
|
||||
#endif
|
||||
|
||||
// The U axis, if any, should be the next open extruder port
|
||||
#if HAS_U_AXIS
|
||||
#ifndef U_STEP_PIN
|
||||
#define U_STEP_PIN _EPIN(U_E_INDEX, STEP)
|
||||
#define U_DIR_PIN _EPIN(U_E_INDEX, DIR)
|
||||
#define U_ENABLE_PIN _EPIN(U_E_INDEX, ENABLE)
|
||||
#if M_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(U_STEP)
|
||||
#error "No E stepper plug left for U!"
|
||||
#else
|
||||
#define AUTO_ASSIGNED_U_STEPPER 1
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(U) && !defined(U_CS_PIN)
|
||||
#define U_CS_PIN _EPIN(U_E_INDEX, CS)
|
||||
#if PIN_EXISTS(U_CS)
|
||||
#define AUTO_ASSIGNED_U_CS 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef U_MS1_PIN
|
||||
#define U_MS1_PIN _EPIN(U_E_INDEX, MS1)
|
||||
#if PIN_EXISTS(U_MS1)
|
||||
#define AUTO_ASSIGNED_U_MS1 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef U_MS2_PIN
|
||||
#define U_MS2_PIN _EPIN(U_E_INDEX, MS2)
|
||||
#if PIN_EXISTS(U_MS2)
|
||||
#define AUTO_ASSIGNED_U_MS2 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef U_MS3_PIN
|
||||
#define U_MS3_PIN _EPIN(U_E_INDEX, MS3)
|
||||
#if PIN_EXISTS(U_MS3)
|
||||
#define AUTO_ASSIGNED_U_MS3 1
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_UART(U)
|
||||
#ifndef U_SERIAL_TX_PIN
|
||||
#define U_SERIAL_TX_PIN _EPIN(U_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef U_SERIAL_RX_PIN
|
||||
#define U_SERIAL_RX_PIN _EPIN(U_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
#if !defined(U_DIAG_PIN) && !defined(U_USE_ENDSTOP) && defined(U_STALL_SENSITIVITY) && _PEXI(U_E_INDEX, DIAG)
|
||||
#define U_DIAG_PIN _EPIN(U_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(U, X_MIN)
|
||||
#define U_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(U, Y_MIN)
|
||||
#define U_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(U, Z_MIN)
|
||||
#define U_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(U, X_MAX)
|
||||
#define U_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(U, Y_MAX)
|
||||
#define U_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(U, Z_MAX)
|
||||
#define U_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define U_USE_ENDSTOP _En_DIAG_(U_E_INDEX)
|
||||
#endif
|
||||
#define AUTO_ASSIGNED_U_DIAG 1
|
||||
#undef U_DIAG_PIN // Defined in Conditionals_post.h based on U_USE_ENDSTOP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef U_CS_PIN
|
||||
#define U_CS_PIN -1
|
||||
#endif
|
||||
#ifndef U_MS1_PIN
|
||||
#define U_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef U_MS2_PIN
|
||||
#define U_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef U_MS3_PIN
|
||||
#define U_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
#if HAS_V_AXIS && !defined(V_DIAG_PIN) && !defined(V_STEP_PIN) && !PIN_EXISTS(V_CS_PIN)
|
||||
#define W_E_INDEX INCREMENT(V_E_INDEX)
|
||||
#else
|
||||
#define W_E_INDEX V_E_INDEX
|
||||
#endif
|
||||
|
||||
// The V axis, if any, should be the next open extruder port
|
||||
#if HAS_V_AXIS
|
||||
#ifndef V_STEP_PIN
|
||||
#define V_STEP_PIN _EPIN(V_E_INDEX, STEP)
|
||||
#define V_DIR_PIN _EPIN(V_E_INDEX, DIR)
|
||||
#define V_ENABLE_PIN _EPIN(V_E_INDEX, ENABLE)
|
||||
#if V_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(V_STEP)
|
||||
#error "No E stepper plug left for V!"
|
||||
#else
|
||||
#define AUTO_ASSIGNED_V_STEPPER 1
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(V) && !defined(V_CS_PIN)
|
||||
#define V_CS_PIN _EPIN(V_E_INDEX, CS)
|
||||
#if PIN_EXISTS(V_CS)
|
||||
#define AUTO_ASSIGNED_V_CS 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef V_MS1_PIN
|
||||
#define V_MS1_PIN _EPIN(V_E_INDEX, MS1)
|
||||
#if PIN_EXISTS(V_MS1)
|
||||
#define AUTO_ASSIGNED_V_MS1 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef V_MS2_PIN
|
||||
#define V_MS2_PIN _EPIN(V_E_INDEX, MS2)
|
||||
#if PIN_EXISTS(V_MS2)
|
||||
#define AUTO_ASSIGNED_V_MS2 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef V_MS3_PIN
|
||||
#define V_MS3_PIN _EPIN(V_E_INDEX, MS3)
|
||||
#if PIN_EXISTS(V_MS3)
|
||||
#define AUTO_ASSIGNED_V_MS3 1
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_UART(V)
|
||||
#ifndef V_SERIAL_TX_PIN
|
||||
#define V_SERIAL_TX_PIN _EPIN(V_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef V_SERIAL_RX_PIN
|
||||
#define V_SERIAL_RX_PIN _EPIN(V_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
#if !defined(V_DIAG_PIN) && !defined(V_USE_ENDSTOP) && defined(V_STALL_SENSITIVITY) && _PEXI(V_E_INDEX, DIAG)
|
||||
#define V_DIAG_PIN _EPIN(V_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(V, X_MIN)
|
||||
#define V_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(V, Y_MIN)
|
||||
#define V_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(V, Z_MIN)
|
||||
#define V_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(V, X_MAX)
|
||||
#define V_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(V, Y_MAX)
|
||||
#define V_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(V, Z_MAX)
|
||||
#define V_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define V_USE_ENDSTOP _En_DIAG_(V_E_INDEX)
|
||||
#endif
|
||||
#define AUTO_ASSIGNED_V_DIAG 1
|
||||
#undef V_DIAG_PIN // Defined in Conditionals_post.h based on O_USE_ENDSTOP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef V_CS_PIN
|
||||
#define V_CS_PIN -1
|
||||
#endif
|
||||
#ifndef V_MS1_PIN
|
||||
#define V_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef V_MS2_PIN
|
||||
#define V_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef V_MS3_PIN
|
||||
#define V_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
// The W axis, if any, should be the next open extruder port
|
||||
#if HAS_W_AXIS
|
||||
#ifndef W_STEP_PIN
|
||||
#define W_STEP_PIN _EPIN(W_E_INDEX, STEP)
|
||||
#define W_DIR_PIN _EPIN(W_E_INDEX, DIR)
|
||||
#define W_ENABLE_PIN _EPIN(W_E_INDEX, ENABLE)
|
||||
#if W_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(W_STEP)
|
||||
#error "No E stepper plug left for W!"
|
||||
#else
|
||||
#define AUTO_ASSIGNED_W_STEPPER 1
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(W) && !defined(W_CS_PIN)
|
||||
#define W_CS_PIN _EPIN(W_E_INDEX, CS)
|
||||
#if PIN_EXISTS(W_CS)
|
||||
#define AUTO_ASSIGNED_W_CS 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef W_MS1_PIN
|
||||
#define W_MS1_PIN _EPIN(W_E_INDEX, MS1)
|
||||
#if PIN_EXISTS(W_MS1)
|
||||
#define AUTO_ASSIGNED_W_MS1 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef W_MS2_PIN
|
||||
#define W_MS2_PIN _EPIN(W_E_INDEX, MS2)
|
||||
#if PIN_EXISTS(W_MS2)
|
||||
#define AUTO_ASSIGNED_W_MS2 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef W_MS3_PIN
|
||||
#define W_MS3_PIN _EPIN(W_E_INDEX, MS3)
|
||||
#if PIN_EXISTS(W_MS3)
|
||||
#define AUTO_ASSIGNED_W_MS3 1
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_UART(W)
|
||||
#ifndef W_SERIAL_TX_PIN
|
||||
#define W_SERIAL_TX_PIN _EPIN(W_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef W_SERIAL_RX_PIN
|
||||
#define W_SERIAL_RX_PIN _EPIN(W_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
#if !defined(W_DIAG_PIN) && !defined(W_USE_ENDSTOP) && defined(W_STALL_SENSITIVITY) && _PEXI(W_E_INDEX, DIAG)
|
||||
#define W_DIAG_PIN _EPIN(W_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(W, X_MIN)
|
||||
#define W_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(W, Y_MIN)
|
||||
#define W_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(W, Z_MIN)
|
||||
#define W_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(W, X_MAX)
|
||||
#define W_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(W, Y_MAX)
|
||||
#define W_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(W, Z_MAX)
|
||||
#define W_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define W_USE_ENDSTOP _En_DIAG_(W_E_INDEX)
|
||||
#endif
|
||||
#define AUTO_ASSIGNED_W_DIAG 1
|
||||
#undef W_DIAG_PIN // Defined in Conditionals_post.h based on Q_USE_ENDSTOP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef W_CS_PIN
|
||||
#define W_CS_PIN -1
|
||||
#endif
|
||||
#ifndef W_MS1_PIN
|
||||
#define W_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef W_MS2_PIN
|
||||
#define W_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef W_MS3_PIN
|
||||
#define W_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
//
|
||||
// Disable unused endstop / probe pins
|
||||
//
|
||||
@@ -1359,6 +1704,30 @@
|
||||
#undef K_MAX_PIN
|
||||
#define K_MAX_PIN -1
|
||||
#endif
|
||||
#if DISABLED(USE_UMIN_PLUG)
|
||||
#undef U_MIN_PIN
|
||||
#define U_MIN_PIN -1
|
||||
#endif
|
||||
#if DISABLED(USE_UMAX_PLUG)
|
||||
#undef U_MAX_PIN
|
||||
#define U_MAX_PIN -1
|
||||
#endif
|
||||
#if DISABLED(USE_VMIN_PLUG)
|
||||
#undef V_MIN_PIN
|
||||
#define V_MIN_PIN -1
|
||||
#endif
|
||||
#if DISABLED(USE_VMAX_PLUG)
|
||||
#undef V_MAX_PIN
|
||||
#define V_MAX_PIN -1
|
||||
#endif
|
||||
#if DISABLED(USE_WMIN_PLUG)
|
||||
#undef W_MIN_PIN
|
||||
#define W_MIN_PIN -1
|
||||
#endif
|
||||
#if DISABLED(USE_WMAX_PLUG)
|
||||
#undef W_MAX_PIN
|
||||
#define W_MAX_PIN -1
|
||||
#endif
|
||||
|
||||
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MAX
|
||||
#undef X2_MIN_PIN
|
||||
|
||||
Reference in New Issue
Block a user