♻️ Patches for Zero Extruders (with TMC)
This commit is contained in:
@@ -438,6 +438,392 @@
|
||||
#define Z_STOP_PIN Z_MAX_PIN
|
||||
#endif
|
||||
|
||||
// Filament Sensor first pin alias
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN
|
||||
#else
|
||||
#undef FIL_RUNOUT_PIN
|
||||
#undef FIL_RUNOUT1_PIN
|
||||
#endif
|
||||
|
||||
#ifndef LCD_PINS_D4
|
||||
#define LCD_PINS_D4 -1
|
||||
#endif
|
||||
|
||||
#if HAS_MARLINUI_HD44780 || TOUCH_UI_ULTIPANEL
|
||||
#ifndef LCD_PINS_D5
|
||||
#define LCD_PINS_D5 -1
|
||||
#endif
|
||||
#ifndef LCD_PINS_D6
|
||||
#define LCD_PINS_D6 -1
|
||||
#endif
|
||||
#ifndef LCD_PINS_D7
|
||||
#define LCD_PINS_D7 -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Auto-Assignment for Dual X, Dual Y, Multi-Z Steppers
|
||||
*
|
||||
* By default X2 is assigned to the next open E plug
|
||||
* on the board, then in order, Y2, Z2, Z3. These can be
|
||||
* overridden in Configuration.h or Configuration_adv.h.
|
||||
*/
|
||||
|
||||
#define __PEXI(p,q) PIN_EXISTS(E##p##_##q)
|
||||
#define _PEXI(p,q) __PEXI(p,q)
|
||||
#define __EPIN(p,q) E##p##_##q##_PIN
|
||||
#define _EPIN(p,q) __EPIN(p,q)
|
||||
#define DIAG_REMAPPED(p,q) (PIN_EXISTS(q) && _EPIN(p##_E_INDEX, DIAG) == q##_PIN)
|
||||
|
||||
// The X2 axis, if any, should be the next open extruder port
|
||||
#define X2_E_INDEX E_STEPPERS
|
||||
|
||||
#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
|
||||
#ifndef X2_STEP_PIN
|
||||
#define X2_STEP_PIN _EPIN(X2_E_INDEX, STEP)
|
||||
#define X2_DIR_PIN _EPIN(X2_E_INDEX, DIR)
|
||||
#define X2_ENABLE_PIN _EPIN(X2_E_INDEX, ENABLE)
|
||||
#if X2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(X2_STEP)
|
||||
#error "No E stepper plug left for X2!"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef X2_MS1_PIN
|
||||
#define X2_MS1_PIN _EPIN(X2_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef X2_MS2_PIN
|
||||
#define X2_MS2_PIN _EPIN(X2_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef X2_MS3_PIN
|
||||
#define X2_MS3_PIN _EPIN(X2_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(X2) && !defined(X2_CS_PIN)
|
||||
#define X2_CS_PIN _EPIN(X2_E_INDEX, CS)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(X2)
|
||||
#ifndef X2_SERIAL_TX_PIN
|
||||
#define X2_SERIAL_TX_PIN _EPIN(X2_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef X2_SERIAL_RX_PIN
|
||||
#define X2_SERIAL_RX_PIN _EPIN(X2_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
//
|
||||
#if !defined(X2_USE_ENDSTOP) && defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
|
||||
#define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(X2, X_MIN) // If already remapped in the pins file...
|
||||
#define X2_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(X2, Y_MIN)
|
||||
#define X2_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(X2, Z_MIN)
|
||||
#define X2_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(X2, X_MAX)
|
||||
#define X2_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(X2, Y_MAX)
|
||||
#define X2_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(X2, Z_MAX)
|
||||
#define X2_USE_ENDSTOP _ZMAX_
|
||||
#else // Otherwise use the driver DIAG_PIN directly
|
||||
#define _X2_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define X2_USE_ENDSTOP _X2_USE_ENDSTOP(X2_E_INDEX)
|
||||
#endif
|
||||
#undef X2_DIAG_PIN
|
||||
#endif
|
||||
|
||||
#define Y2_E_INDEX INCREMENT(X2_E_INDEX)
|
||||
#else
|
||||
#define Y2_E_INDEX X2_E_INDEX
|
||||
#endif
|
||||
|
||||
#ifndef X2_CS_PIN
|
||||
#define X2_CS_PIN -1
|
||||
#endif
|
||||
#ifndef X2_MS1_PIN
|
||||
#define X2_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef X2_MS2_PIN
|
||||
#define X2_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef X2_MS3_PIN
|
||||
#define X2_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
// The Y2 axis, if any, should be the next open extruder port
|
||||
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
|
||||
#ifndef Y2_STEP_PIN
|
||||
#define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP)
|
||||
#define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR)
|
||||
#define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
|
||||
#if Y2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Y2_STEP)
|
||||
#error "No E stepper plug left for Y2!"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Y2_MS1_PIN
|
||||
#define Y2_MS1_PIN _EPIN(Y2_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef Y2_MS2_PIN
|
||||
#define Y2_MS2_PIN _EPIN(Y2_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef Y2_MS3_PIN
|
||||
#define Y2_MS3_PIN _EPIN(Y2_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Y2) && !defined(Y2_CS_PIN)
|
||||
#define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(Y2)
|
||||
#ifndef Y2_SERIAL_TX_PIN
|
||||
#define Y2_SERIAL_TX_PIN _EPIN(Y2_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef Y2_SERIAL_RX_PIN
|
||||
#define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
#if !defined(Y2_USE_ENDSTOP) && defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
|
||||
#define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(Y2, X_MIN)
|
||||
#define Y2_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(Y2, Y_MIN)
|
||||
#define Y2_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(Y2, Z_MIN)
|
||||
#define Y2_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(Y2, X_MAX)
|
||||
#define Y2_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(Y2, Y_MAX)
|
||||
#define Y2_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(Y2, Z_MAX)
|
||||
#define Y2_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define _Y2_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define Y2_USE_ENDSTOP _Y2_USE_ENDSTOP(Y2_E_INDEX)
|
||||
#endif
|
||||
#undef Y2_DIAG_PIN
|
||||
#endif
|
||||
#define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
|
||||
#else
|
||||
#define Z2_E_INDEX Y2_E_INDEX
|
||||
#endif
|
||||
|
||||
#ifndef Y2_CS_PIN
|
||||
#define Y2_CS_PIN -1
|
||||
#endif
|
||||
#ifndef Y2_MS1_PIN
|
||||
#define Y2_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef Y2_MS2_PIN
|
||||
#define Y2_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef Y2_MS3_PIN
|
||||
#define Y2_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
// The Z2 axis, if any, should be the next open extruder port
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 2
|
||||
#ifndef Z2_STEP_PIN
|
||||
#define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP)
|
||||
#define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR)
|
||||
#define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
|
||||
#if Z2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z2_STEP)
|
||||
#error "No E stepper plug left for Z2!"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Z2_MS1_PIN
|
||||
#define Z2_MS1_PIN _EPIN(Z2_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef Z2_MS2_PIN
|
||||
#define Z2_MS2_PIN _EPIN(Z2_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef Z2_MS3_PIN
|
||||
#define Z2_MS3_PIN _EPIN(Z2_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z2) && !defined(Z2_CS_PIN)
|
||||
#define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(Z2)
|
||||
#ifndef Z2_SERIAL_TX_PIN
|
||||
#define Z2_SERIAL_TX_PIN _EPIN(Z2_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef Z2_SERIAL_RX_PIN
|
||||
#define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
#if !defined(Z2_USE_ENDSTOP) && defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG)
|
||||
#define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(Z2, X_MIN)
|
||||
#define Z2_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(Z2, Y_MIN)
|
||||
#define Z2_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(Z2, Z_MIN)
|
||||
#define Z2_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(Z2, X_MAX)
|
||||
#define Z2_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(Z2, Y_MAX)
|
||||
#define Z2_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(Z2, Z_MAX)
|
||||
#define Z2_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define _Z2_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define Z2_USE_ENDSTOP _Z2_USE_ENDSTOP(Z2_E_INDEX)
|
||||
#endif
|
||||
#undef Z2_DIAG_PIN
|
||||
#endif
|
||||
#define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
|
||||
#else
|
||||
#define Z3_E_INDEX Z2_E_INDEX
|
||||
#endif
|
||||
|
||||
#ifndef Z2_CS_PIN
|
||||
#define Z2_CS_PIN -1
|
||||
#endif
|
||||
#ifndef Z2_MS1_PIN
|
||||
#define Z2_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef Z2_MS2_PIN
|
||||
#define Z2_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef Z2_MS3_PIN
|
||||
#define Z2_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
#ifndef Z3_STEP_PIN
|
||||
#define Z3_STEP_PIN _EPIN(Z3_E_INDEX, STEP)
|
||||
#define Z3_DIR_PIN _EPIN(Z3_E_INDEX, DIR)
|
||||
#define Z3_ENABLE_PIN _EPIN(Z3_E_INDEX, ENABLE)
|
||||
#if Z3_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z3_STEP)
|
||||
#error "No E stepper plug left for Z3!"
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z3)
|
||||
#ifndef Z3_CS_PIN
|
||||
#define Z3_CS_PIN _EPIN(Z3_E_INDEX, CS)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Z3_MS1_PIN
|
||||
#define Z3_MS1_PIN _EPIN(Z3_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef Z3_MS2_PIN
|
||||
#define Z3_MS2_PIN _EPIN(Z3_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef Z3_MS3_PIN
|
||||
#define Z3_MS3_PIN _EPIN(Z3_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(Z3)
|
||||
#ifndef Z3_SERIAL_TX_PIN
|
||||
#define Z3_SERIAL_TX_PIN _EPIN(Z3_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef Z3_SERIAL_RX_PIN
|
||||
#define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
#if !defined(Z3_USE_ENDSTOP) && defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG)
|
||||
#define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(Z3, X_MIN)
|
||||
#define Z3_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(Z3, Y_MIN)
|
||||
#define Z3_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(Z3, Z_MIN)
|
||||
#define Z3_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(Z3, X_MAX)
|
||||
#define Z3_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(Z3, Y_MAX)
|
||||
#define Z3_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(Z3, Z_MAX)
|
||||
#define Z3_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define _Z3_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define Z3_USE_ENDSTOP _Z3_USE_ENDSTOP(Z3_E_INDEX)
|
||||
#endif
|
||||
#undef Z3_DIAG_PIN
|
||||
#endif
|
||||
#define Z4_E_INDEX INCREMENT(Z3_E_INDEX)
|
||||
#endif
|
||||
|
||||
#ifndef Z3_CS_PIN
|
||||
#define Z3_CS_PIN -1
|
||||
#endif
|
||||
#ifndef Z3_MS1_PIN
|
||||
#define Z3_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef Z3_MS2_PIN
|
||||
#define Z3_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef Z3_MS3_PIN
|
||||
#define Z3_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 4
|
||||
#ifndef Z4_STEP_PIN
|
||||
#define Z4_STEP_PIN _EPIN(Z4_E_INDEX, STEP)
|
||||
#define Z4_DIR_PIN _EPIN(Z4_E_INDEX, DIR)
|
||||
#define Z4_ENABLE_PIN _EPIN(Z4_E_INDEX, ENABLE)
|
||||
#if Z4_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z4_STEP)
|
||||
#error "No E stepper plug left for Z4!"
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z4)
|
||||
#ifndef Z4_CS_PIN
|
||||
#define Z4_CS_PIN _EPIN(Z4_E_INDEX, CS)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Z4_MS1_PIN
|
||||
#define Z4_MS1_PIN _EPIN(Z4_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef Z4_MS2_PIN
|
||||
#define Z4_MS2_PIN _EPIN(Z4_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef Z4_MS3_PIN
|
||||
#define Z4_MS3_PIN _EPIN(Z4_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(Z4)
|
||||
#ifndef Z4_SERIAL_TX_PIN
|
||||
#define Z4_SERIAL_TX_PIN _EPIN(Z4_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef Z4_SERIAL_RX_PIN
|
||||
#define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
#if !defined(Z4_USE_ENDSTOP) && defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG)
|
||||
#define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(Z4, X_MIN)
|
||||
#define Z4_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(Z4, Y_MIN)
|
||||
#define Z4_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(Z4, Z_MIN)
|
||||
#define Z4_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(Z4, X_MAX)
|
||||
#define Z4_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(Z4, Y_MAX)
|
||||
#define Z4_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(Z4, Z_MAX)
|
||||
#define Z4_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define _Z4_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define Z4_USE_ENDSTOP _Z4_USE_ENDSTOP(Z4_E_INDEX)
|
||||
#endif
|
||||
#undef Z4_DIAG_PIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef Z4_CS_PIN
|
||||
#define Z4_CS_PIN -1
|
||||
#endif
|
||||
#ifndef Z4_MS1_PIN
|
||||
#define Z4_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef Z4_MS2_PIN
|
||||
#define Z4_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef Z4_MS3_PIN
|
||||
#define Z4_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
//
|
||||
// Disable unused endstop / probe pins
|
||||
//
|
||||
@@ -520,387 +906,9 @@
|
||||
#undef Z4_MAX_PIN
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN
|
||||
#else
|
||||
#undef FIL_RUNOUT_PIN
|
||||
#undef FIL_RUNOUT1_PIN
|
||||
#endif
|
||||
|
||||
#ifndef LCD_PINS_D4
|
||||
#define LCD_PINS_D4 -1
|
||||
#endif
|
||||
|
||||
#if HAS_MARLINUI_HD44780 || TOUCH_UI_ULTIPANEL
|
||||
#ifndef LCD_PINS_D5
|
||||
#define LCD_PINS_D5 -1
|
||||
#endif
|
||||
#ifndef LCD_PINS_D6
|
||||
#define LCD_PINS_D6 -1
|
||||
#endif
|
||||
#ifndef LCD_PINS_D7
|
||||
#define LCD_PINS_D7 -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Auto-Assignment for Dual X, Dual Y, Multi-Z Steppers
|
||||
*
|
||||
* By default X2 is assigned to the next open E plug
|
||||
* on the board, then in order, Y2, Z2, Z3. These can be
|
||||
* overridden in Configuration.h or Configuration_adv.h.
|
||||
*/
|
||||
|
||||
#define __PEXI(p,q) PIN_EXISTS(E##p##_##q)
|
||||
#define _PEXI(p,q) __PEXI(p,q)
|
||||
#define __EPIN(p,q) E##p##_##q##_PIN
|
||||
#define _EPIN(p,q) __EPIN(p,q)
|
||||
#define DIAG_REMAPPED(p,q) (PIN_EXISTS(q) && _EPIN(p##_E_INDEX, DIAG) == q##_PIN)
|
||||
|
||||
// The X2 axis, if any, should be the next open extruder port
|
||||
#define X2_E_INDEX E_STEPPERS
|
||||
|
||||
#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
|
||||
#ifndef X2_STEP_PIN
|
||||
#define X2_STEP_PIN _EPIN(X2_E_INDEX, STEP)
|
||||
#define X2_DIR_PIN _EPIN(X2_E_INDEX, DIR)
|
||||
#define X2_ENABLE_PIN _EPIN(X2_E_INDEX, ENABLE)
|
||||
#if X2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(X2_STEP)
|
||||
#error "No E stepper plug left for X2!"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef X2_MS1_PIN
|
||||
#define X2_MS1_PIN _EPIN(X2_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef X2_MS2_PIN
|
||||
#define X2_MS2_PIN _EPIN(X2_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef X2_MS3_PIN
|
||||
#define X2_MS3_PIN _EPIN(X2_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(X2) && !defined(X2_CS_PIN)
|
||||
#define X2_CS_PIN _EPIN(X2_E_INDEX, CS)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(X2)
|
||||
#ifndef X2_SERIAL_TX_PIN
|
||||
#define X2_SERIAL_TX_PIN _EPIN(X2_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef X2_SERIAL_RX_PIN
|
||||
#define X2_SERIAL_RX_PIN _EPIN(X2_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Auto-assign pins for stallGuard sensorless homing
|
||||
//
|
||||
#if defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
|
||||
#define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(X2, X_MIN) // If already remapped in the pins file...
|
||||
#define X2_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(X2, Y_MIN)
|
||||
#define X2_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(X2, Z_MIN)
|
||||
#define X2_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(X2, X_MAX)
|
||||
#define X2_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(X2, Y_MAX)
|
||||
#define X2_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(X2, Z_MAX)
|
||||
#define X2_USE_ENDSTOP _ZMAX_
|
||||
#else // Otherwise use the driver DIAG_PIN directly
|
||||
#define _X2_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define X2_USE_ENDSTOP _X2_USE_ENDSTOP(X2_E_INDEX)
|
||||
#endif
|
||||
#undef X2_DIAG_PIN
|
||||
#endif
|
||||
|
||||
#define Y2_E_INDEX INCREMENT(X2_E_INDEX)
|
||||
#else
|
||||
#define Y2_E_INDEX X2_E_INDEX
|
||||
#endif
|
||||
|
||||
#ifndef X2_CS_PIN
|
||||
#define X2_CS_PIN -1
|
||||
#endif
|
||||
#ifndef X2_MS1_PIN
|
||||
#define X2_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef X2_MS2_PIN
|
||||
#define X2_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef X2_MS3_PIN
|
||||
#define X2_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
// The Y2 axis, if any, should be the next open extruder port
|
||||
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
|
||||
#ifndef Y2_STEP_PIN
|
||||
#define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP)
|
||||
#define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR)
|
||||
#define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
|
||||
#if Y2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Y2_STEP)
|
||||
#error "No E stepper plug left for Y2!"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Y2_MS1_PIN
|
||||
#define Y2_MS1_PIN _EPIN(Y2_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef Y2_MS2_PIN
|
||||
#define Y2_MS2_PIN _EPIN(Y2_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef Y2_MS3_PIN
|
||||
#define Y2_MS3_PIN _EPIN(Y2_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Y2) && !defined(Y2_CS_PIN)
|
||||
#define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(Y2)
|
||||
#ifndef Y2_SERIAL_TX_PIN
|
||||
#define Y2_SERIAL_TX_PIN _EPIN(Y2_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef Y2_SERIAL_RX_PIN
|
||||
#define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
|
||||
#define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(Y2, X_MIN)
|
||||
#define Y2_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(Y2, Y_MIN)
|
||||
#define Y2_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(Y2, Z_MIN)
|
||||
#define Y2_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(Y2, X_MAX)
|
||||
#define Y2_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(Y2, Y_MAX)
|
||||
#define Y2_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(Y2, Z_MAX)
|
||||
#define Y2_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define _Y2_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define Y2_USE_ENDSTOP _Y2_USE_ENDSTOP(Y2_E_INDEX)
|
||||
#endif
|
||||
#undef Y2_DIAG_PIN
|
||||
#endif
|
||||
#define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
|
||||
#else
|
||||
#define Z2_E_INDEX Y2_E_INDEX
|
||||
#endif
|
||||
|
||||
#ifndef Y2_CS_PIN
|
||||
#define Y2_CS_PIN -1
|
||||
#endif
|
||||
#ifndef Y2_MS1_PIN
|
||||
#define Y2_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef Y2_MS2_PIN
|
||||
#define Y2_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef Y2_MS3_PIN
|
||||
#define Y2_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
// The Z2 axis, if any, should be the next open extruder port
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 2
|
||||
#ifndef Z2_STEP_PIN
|
||||
#define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP)
|
||||
#define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR)
|
||||
#define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
|
||||
#if Z2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z2_STEP)
|
||||
#error "No E stepper plug left for Z2!"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Z2_MS1_PIN
|
||||
#define Z2_MS1_PIN _EPIN(Z2_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef Z2_MS2_PIN
|
||||
#define Z2_MS2_PIN _EPIN(Z2_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef Z2_MS3_PIN
|
||||
#define Z2_MS3_PIN _EPIN(Z2_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z2) && !defined(Z2_CS_PIN)
|
||||
#define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(Z2)
|
||||
#ifndef Z2_SERIAL_TX_PIN
|
||||
#define Z2_SERIAL_TX_PIN _EPIN(Z2_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef Z2_SERIAL_RX_PIN
|
||||
#define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG)
|
||||
#define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(Z2, X_MIN)
|
||||
#define Z2_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(Z2, Y_MIN)
|
||||
#define Z2_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(Z2, Z_MIN)
|
||||
#define Z2_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(Z2, X_MAX)
|
||||
#define Z2_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(Z2, Y_MAX)
|
||||
#define Z2_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(Z2, Z_MAX)
|
||||
#define Z2_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define _Z2_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define Z2_USE_ENDSTOP _Z2_USE_ENDSTOP(Z2_E_INDEX)
|
||||
#endif
|
||||
#undef Z2_DIAG_PIN
|
||||
#endif
|
||||
#define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
|
||||
#else
|
||||
#define Z3_E_INDEX Z2_E_INDEX
|
||||
#endif
|
||||
|
||||
#ifndef Z2_CS_PIN
|
||||
#define Z2_CS_PIN -1
|
||||
#endif
|
||||
#ifndef Z2_MS1_PIN
|
||||
#define Z2_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef Z2_MS2_PIN
|
||||
#define Z2_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef Z2_MS3_PIN
|
||||
#define Z2_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
#ifndef Z3_STEP_PIN
|
||||
#define Z3_STEP_PIN _EPIN(Z3_E_INDEX, STEP)
|
||||
#define Z3_DIR_PIN _EPIN(Z3_E_INDEX, DIR)
|
||||
#define Z3_ENABLE_PIN _EPIN(Z3_E_INDEX, ENABLE)
|
||||
#if Z3_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z3_STEP)
|
||||
#error "No E stepper plug left for Z3!"
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z3)
|
||||
#ifndef Z3_CS_PIN
|
||||
#define Z3_CS_PIN _EPIN(Z3_E_INDEX, CS)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Z3_MS1_PIN
|
||||
#define Z3_MS1_PIN _EPIN(Z3_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef Z3_MS2_PIN
|
||||
#define Z3_MS2_PIN _EPIN(Z3_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef Z3_MS3_PIN
|
||||
#define Z3_MS3_PIN _EPIN(Z3_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(Z3)
|
||||
#ifndef Z3_SERIAL_TX_PIN
|
||||
#define Z3_SERIAL_TX_PIN _EPIN(Z3_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef Z3_SERIAL_RX_PIN
|
||||
#define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG)
|
||||
#define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(Z3, X_MIN)
|
||||
#define Z3_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(Z3, Y_MIN)
|
||||
#define Z3_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(Z3, Z_MIN)
|
||||
#define Z3_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(Z3, X_MAX)
|
||||
#define Z3_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(Z3, Y_MAX)
|
||||
#define Z3_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(Z3, Z_MAX)
|
||||
#define Z3_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define _Z3_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define Z3_USE_ENDSTOP _Z3_USE_ENDSTOP(Z3_E_INDEX)
|
||||
#endif
|
||||
#undef Z3_DIAG_PIN
|
||||
#endif
|
||||
#define Z4_E_INDEX INCREMENT(Z3_E_INDEX)
|
||||
#endif
|
||||
|
||||
#ifndef Z3_CS_PIN
|
||||
#define Z3_CS_PIN -1
|
||||
#endif
|
||||
#ifndef Z3_MS1_PIN
|
||||
#define Z3_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef Z3_MS2_PIN
|
||||
#define Z3_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef Z3_MS3_PIN
|
||||
#define Z3_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 4
|
||||
#ifndef Z4_STEP_PIN
|
||||
#define Z4_STEP_PIN _EPIN(Z4_E_INDEX, STEP)
|
||||
#define Z4_DIR_PIN _EPIN(Z4_E_INDEX, DIR)
|
||||
#define Z4_ENABLE_PIN _EPIN(Z4_E_INDEX, ENABLE)
|
||||
#if Z4_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z4_STEP)
|
||||
#error "No E stepper plug left for Z4!"
|
||||
#endif
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z4)
|
||||
#ifndef Z4_CS_PIN
|
||||
#define Z4_CS_PIN _EPIN(Z4_E_INDEX, CS)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Z4_MS1_PIN
|
||||
#define Z4_MS1_PIN _EPIN(Z4_E_INDEX, MS1)
|
||||
#endif
|
||||
#ifndef Z4_MS2_PIN
|
||||
#define Z4_MS2_PIN _EPIN(Z4_E_INDEX, MS2)
|
||||
#endif
|
||||
#ifndef Z4_MS3_PIN
|
||||
#define Z4_MS3_PIN _EPIN(Z4_E_INDEX, MS3)
|
||||
#endif
|
||||
#if AXIS_HAS_UART(Z4)
|
||||
#ifndef Z4_SERIAL_TX_PIN
|
||||
#define Z4_SERIAL_TX_PIN _EPIN(Z4_E_INDEX, SERIAL_TX)
|
||||
#endif
|
||||
#ifndef Z4_SERIAL_RX_PIN
|
||||
#define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG)
|
||||
#define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG)
|
||||
#if DIAG_REMAPPED(Z4, X_MIN)
|
||||
#define Z4_USE_ENDSTOP _XMIN_
|
||||
#elif DIAG_REMAPPED(Z4, Y_MIN)
|
||||
#define Z4_USE_ENDSTOP _YMIN_
|
||||
#elif DIAG_REMAPPED(Z4, Z_MIN)
|
||||
#define Z4_USE_ENDSTOP _ZMIN_
|
||||
#elif DIAG_REMAPPED(Z4, X_MAX)
|
||||
#define Z4_USE_ENDSTOP _XMAX_
|
||||
#elif DIAG_REMAPPED(Z4, Y_MAX)
|
||||
#define Z4_USE_ENDSTOP _YMAX_
|
||||
#elif DIAG_REMAPPED(Z4, Z_MAX)
|
||||
#define Z4_USE_ENDSTOP _ZMAX_
|
||||
#else
|
||||
#define _Z4_USE_ENDSTOP(P) _E##P##_DIAG_
|
||||
#define Z4_USE_ENDSTOP _Z4_USE_ENDSTOP(Z4_E_INDEX)
|
||||
#endif
|
||||
#undef Z4_DIAG_PIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef Z4_CS_PIN
|
||||
#define Z4_CS_PIN -1
|
||||
#endif
|
||||
#ifndef Z4_MS1_PIN
|
||||
#define Z4_MS1_PIN -1
|
||||
#endif
|
||||
#ifndef Z4_MS2_PIN
|
||||
#define Z4_MS2_PIN -1
|
||||
#endif
|
||||
#ifndef Z4_MS3_PIN
|
||||
#define Z4_MS3_PIN -1
|
||||
#endif
|
||||
|
||||
//
|
||||
// Default DOGLCD SPI delays
|
||||
//
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
#if !defined(ST7920_DELAY_1) && defined(BOARD_ST7920_DELAY_1)
|
||||
#define ST7920_DELAY_1 BOARD_ST7920_DELAY_1
|
||||
|
Reference in New Issue
Block a user