Auto-assign CS pins for X2, Y2, Z2 (#10056)

Fixes #9211
This commit is contained in:
Scott Lahteine 2018-03-11 09:25:02 -05:00 committed by GitHub
parent d1256be7ec
commit 879b54a8bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,6 +367,31 @@
#define E4_ENABLE_PIN -1 #define E4_ENABLE_PIN -1
#endif #endif
#ifndef X_CS_PIN
#define X_CS_PIN -1
#endif
#ifndef Y_CS_PIN
#define Y_CS_PIN -1
#endif
#ifndef Z_CS_PIN
#define Z_CS_PIN -1
#endif
#ifndef E0_CS_PIN
#define E0_CS_PIN -1
#endif
#ifndef E1_CS_PIN
#define E1_CS_PIN -1
#endif
#ifndef E2_CS_PIN
#define E2_CS_PIN -1
#endif
#ifndef E3_CS_PIN
#define E3_CS_PIN -1
#endif
#ifndef E4_CS_PIN
#define E4_CS_PIN -1
#endif
#ifndef FAN_PIN #ifndef FAN_PIN
#define FAN_PIN -1 #define FAN_PIN -1
#endif #endif
@ -454,9 +479,6 @@
#define MAX_EXTRUDERS 5 #define MAX_EXTRUDERS 5
#endif #endif
// Marlin needs to account for pins that equal -1
#define marlinAnalogInputToDigitalPin(p) ((p) == -1 ? -1 : analogInputToDigitalPin(p))
// //
// Assign auto fan pins if needed // Assign auto fan pins if needed
// //
@ -497,7 +519,7 @@
#endif #endif
// List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those! // List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, E0_CS_PIN,
#define _E1_PINS #define _E1_PINS
#define _E2_PINS #define _E2_PINS
#define _E3_PINS #define _E3_PINS
@ -507,29 +529,32 @@
// Tools 0 and 1 use E0 // Tools 0 and 1 use E0
#if EXTRUDERS > 2 // Tools 2 and 3 use E1 #if EXTRUDERS > 2 // Tools 2 and 3 use E1
#undef _E1_PINS #undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
#if EXTRUDERS > 4 // Tools 4 and 5 use E2 #if EXTRUDERS > 4 // Tools 4 and 5 use E2
#undef _E2_PINS #undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
#endif #endif
#endif #endif
#elif EXTRUDERS > 1 #elif EXTRUDERS > 1
#undef _E1_PINS #undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
#if EXTRUDERS > 2 #if EXTRUDERS > 2
#undef _E2_PINS #undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
#if EXTRUDERS > 3 #if EXTRUDERS > 3
#undef _E3_PINS #undef _E3_PINS
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, E3_MS3_PIN, E3_CS_PIN,
#if EXTRUDERS > 4 #if EXTRUDERS > 4
#undef _E4_PINS #undef _E4_PINS
#define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, E4_MS3_PIN, E4_CS_PIN,
#endif // EXTRUDERS > 4 #endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3 #endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2 #endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1 #endif // EXTRUDERS > 1
// Marlin needs to account for pins that equal -1
#define marlinAnalogInputToDigitalPin(p) ((p) == -1 ? -1 : analogInputToDigitalPin(p))
#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN), #define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN),
#define _H1_PINS #define _H1_PINS
#define _H2_PINS #define _H2_PINS
@ -553,16 +578,16 @@
#endif // HOTENDS > 2 #endif // HOTENDS > 2
#elif ENABLED(MIXING_EXTRUDER) #elif ENABLED(MIXING_EXTRUDER)
#undef _E1_PINS #undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
#if MIXING_STEPPERS > 2 #if MIXING_STEPPERS > 2
#undef _E2_PINS #undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
#if MIXING_STEPPERS > 3 #if MIXING_STEPPERS > 3
#undef _E3_PINS #undef _E3_PINS
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, E3_CS_PIN,
#if MIXING_STEPPERS > 4 #if MIXING_STEPPERS > 4
#undef _E4_PINS #undef _E4_PINS
#define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, E4_CS_PIN,
#endif // MIXING_STEPPERS > 4 #endif // MIXING_STEPPERS > 4
#endif // MIXING_STEPPERS > 3 #endif // MIXING_STEPPERS > 3
#endif // MIXING_STEPPERS > 2 #endif // MIXING_STEPPERS > 2
@ -671,12 +696,13 @@
#define X2_STEP_PIN _EPIN(E_STEPPERS, STEP) #define X2_STEP_PIN _EPIN(E_STEPPERS, STEP)
#define X2_DIR_PIN _EPIN(E_STEPPERS, DIR) #define X2_DIR_PIN _EPIN(E_STEPPERS, DIR)
#define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE) #define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
#define X2_CS_PIN _EPIN(E_STEPPERS, CS)
#if E_STEPPERS > 4 || !PIN_EXISTS(X2_ENABLE) #if E_STEPPERS > 4 || !PIN_EXISTS(X2_ENABLE)
#error "No E stepper plug left for X2!" #error "No E stepper plug left for X2!"
#endif #endif
#endif #endif
#undef _X2_PINS #undef _X2_PINS
#define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, #define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, X2_CS_PIN,
#define Y2_E_INDEX INCREMENT(E_STEPPERS) #define Y2_E_INDEX INCREMENT(E_STEPPERS)
#else #else
#define Y2_E_INDEX E_STEPPERS #define Y2_E_INDEX E_STEPPERS
@ -688,12 +714,13 @@
#define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP) #define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP)
#define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR) #define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR)
#define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE) #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
#define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS)
#if Y2_E_INDEX > 4 || !PIN_EXISTS(Y2_ENABLE) #if Y2_E_INDEX > 4 || !PIN_EXISTS(Y2_ENABLE)
#error "No E stepper plug left for Y2!" #error "No E stepper plug left for Y2!"
#endif #endif
#endif #endif
#undef _Y2_PINS #undef _Y2_PINS
#define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, #define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, Y2_CS_PIN,
#define Z2_E_INDEX INCREMENT(Y2_E_INDEX) #define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
#else #else
#define Z2_E_INDEX Y2_E_INDEX #define Z2_E_INDEX Y2_E_INDEX
@ -705,23 +732,23 @@
#define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP) #define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP)
#define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR) #define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR)
#define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE) #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
#define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS)
#if Z2_E_INDEX > 4 || !PIN_EXISTS(Z2_ENABLE) #if Z2_E_INDEX > 4 || !PIN_EXISTS(Z2_ENABLE)
#error "No E stepper plug left for Z2!" #error "No E stepper plug left for Z2!"
#endif #endif
#endif #endif
#undef _Z2_PINS #undef _Z2_PINS
#define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, Z2_CS_PIN,
#endif #endif
#define SENSITIVE_PINS { 0, 1, \ #define SENSITIVE_PINS { 0, 1, \
X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \ X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, X_MS1_PIN, X_MS2_PIN, X_CS_PIN, \
Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, \ Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Y_MS1_PIN, Y_MS2_PIN, Y_CS_PIN, \
Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MIN_PROBE_PIN, \ Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MS1_PIN, Z_MS2_PIN, Z_MS3_PIN, Z_CS_PIN, Z_MIN_PROBE_PIN, \
PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLER_FAN_PIN, \ PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLER_FAN_PIN, \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS BED_PINS \ _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS BED_PINS \
_H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS \ _H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS \
_X2_PINS _Y2_PINS _Z2_PINS \ _X2_PINS _Y2_PINS _Z2_PINS \
X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN \
} }
#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))