Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.1.x] Hangprinter support #9180

Merged
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Assign ABCD like X2, Y2, Z2

  • Loading branch information...
thinkyhead committed Sep 8, 2018
commit e133dbe7a766975c8967256605f148be4fd2a92f
@@ -60,56 +60,32 @@ extern const char axis_codes[XYZE];

#if HAS_X2_ENABLE
#define enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
#if ENABLED(HANGPRINTER)
#define disable_X() NOOP
#else
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
#endif
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
#elif HAS_X_ENABLE
#define enable_X() X_ENABLE_WRITE( X_ENABLE_ON)
#if ENABLED(HANGPRINTER)
#define disable_X() NOOP
#else
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
#endif
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
#else
#define enable_X() NOOP
#define disable_X() NOOP
#endif

#if HAS_Y2_ENABLE
#define enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
#if ENABLED(HANGPRINTER)
#define disable_Y() NOOP
#else
#define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
#endif
#define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
#elif HAS_Y_ENABLE
#define enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
#if ENABLED(HANGPRINTER)
#define disable_Y() NOOP
#else
#define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
#endif
#define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
#else
#define enable_Y() NOOP
#define disable_Y() NOOP
#endif

#if HAS_Z2_ENABLE
#define enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
#if ENABLED(HANGPRINTER)
#define disable_Z() NOOP
#else
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#endif
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#elif HAS_Z_ENABLE
#define enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
#if ENABLED(HANGPRINTER)
#define disable_Z() NOOP
#else
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#endif
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#else
#define enable_Z() NOOP
#define disable_Z() NOOP
@@ -191,18 +167,18 @@ extern const char axis_codes[XYZE];
#define enable_A() enable_X()
#define enable_B() enable_Y()
#define enable_C() enable_Z()
#define __D_ENABLE(p) E##p##_ENABLE_WRITE(E_ENABLE_ON)
#define _D_ENABLE(p) __D_ENABLE(p)
#define enable_D() _D_ENABLE(EXTRUDERS)

// Don't allow any axes to be disabled
#undef disable_X
#undef disable_Y
#undef disable_Z
#define disable_X() NOOP
#define disable_Y() NOOP
#define disable_Z() NOOP

#if EXTRUDERS == 1
#define enable_D() E1_ENABLE_WRITE(E_ENABLE_ON)
#elif EXTRUDERS == 2
#define enable_D() E2_ENABLE_WRITE(E_ENABLE_ON)
#elif EXTRUDERS == 3
#define enable_D() E3_ENABLE_WRITE(E_ENABLE_ON)
#elif EXTRUDERS == 4
#define enable_D() E4_ENABLE_WRITE(E_ENABLE_ON)
#endif

// Don't allow D Axis to be disabled
#if EXTRUDERS >= 1
#undef disable_E1
#define disable_E1() NOOP
@@ -696,23 +696,72 @@
// Dual X-carriage, Dual Y, Dual Z support
//

#define _D_PINS
#define _X2_PINS
#define _Y2_PINS
#define _Z2_PINS

#define __EPIN(p,q) E##p##_##q##_PIN
#define _EPIN(p,q) __EPIN(p,q)

// The HANGPRINTER A, B, C, D axes
#if ENABLED(HANGPRINTER)
#define A_ENABLE_PIN X_ENABLE_PIN
#define A_DIR_PIN X_DIR_PIN
#define A_STEP_PIN X_STEP_PIN
#define A_MS1_PIN X_MS1_PIN

#define B_ENABLE_PIN Y_ENABLE_PIN
#define B_DIR_PIN Y_DIR_PIN
#define B_STEP_PIN Y_STEP_PIN
#define B_MS1_PIN Y_MS1_PIN

#define C_ENABLE_PIN Z_ENABLE_PIN
#define C_DIR_PIN Z_DIR_PIN
#define C_STEP_PIN Z_STEP_PIN
#define C_MS1_PIN Z_MS1_PIN

#ifndef D_STEP_PIN
#define D_STEP_PIN _EPIN(E_STEPPERS, STEP)
#define D_DIR_PIN _EPIN(E_STEPPERS, DIR)
#define D_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
#ifndef D_CS_PIN
#define D_CS_PIN _EPIN(E_STEPPERS, CS)
#endif
#ifndef D_MS1_PIN
#define D_MS1_PIN _EPIN(E_STEPPERS, MS1)
#endif
#if E_STEPPERS >= MAX_EXTRUDERS || !PIN_EXISTS(D_ENABLE)
#error "No E stepper plug left for D Axis!"
#endif
#endif
#undef _D_PINS
#define ___D_PINS D_STEP_PIN, D_DIR_PIN, D_ENABLE_PIN,
#ifdef D_CS_PIN
#define __D_PINS ___D_PINS D_CS_PIN,
#else
#define __D_PINS ___D_PINS
#endif
#ifdef D_MS1_PIN
#define _D_PINS __D_PINS D_MS1_PIN,
#else
#define _D_PINS __D_PINS
#endif
#define X2_E_INDEX INCREMENT(E_STEPPERS)
#else
#define X2_E_INDEX E_STEPPERS
#endif

// The X2 axis, if any, should be the next open extruder port
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)
#ifndef X2_STEP_PIN
#define X2_STEP_PIN _EPIN(E_STEPPERS, STEP)
#define X2_DIR_PIN _EPIN(E_STEPPERS, DIR)
#define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
#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)
#ifndef X2_CS_PIN
#define X2_CS_PIN _EPIN(E_STEPPERS, CS)
#define X2_CS_PIN _EPIN(X2_E_INDEX, CS)
#endif
#if E_STEPPERS > 4 || !PIN_EXISTS(X2_ENABLE)
#if X2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(X2_ENABLE)
#error "No E stepper plug left for X2!"
#endif
#endif
@@ -723,9 +772,9 @@
#else
#define _X2_PINS __X2_PINS
#endif
#define Y2_E_INDEX INCREMENT(E_STEPPERS)
#define Y2_E_INDEX INCREMENT(X2_E_INDEX)
#else
#define Y2_E_INDEX E_STEPPERS
#define Y2_E_INDEX X2_E_INDEX
#endif

// The Y2 axis, if any, should be the next open extruder port
@@ -737,7 +786,7 @@
#ifndef Y2_CS_PIN
#define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS)
#endif
#if Y2_E_INDEX > 4 || !PIN_EXISTS(Y2_ENABLE)
#if Y2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Y2_ENABLE)
#error "No E stepper plug left for Y2!"
#endif
#endif
@@ -762,7 +811,7 @@
#ifndef Z2_CS_PIN
#define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS)
#endif
#if Z2_E_INDEX > 4 || !PIN_EXISTS(Z2_ENABLE)
#if Z2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z2_ENABLE)
#error "No E stepper plug left for Z2!"
#endif
#endif
@@ -782,7 +831,7 @@
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 \
_H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS \
_X2_PINS _Y2_PINS _Z2_PINS \
_D_PINS _X2_PINS _Y2_PINS _Z2_PINS \
}

#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
@@ -271,56 +271,19 @@ int8_t Stepper::count_direction[NUM_AXIS] = {
* Place D connector on your first "free" extruder output.
*/
#if ENABLED(HANGPRINTER)
#define A_ENABLE_PIN X_ENABLE_PIN
#define A_DIR_PIN X_DIR_PIN
#define A_STEP_PIN X_STEP_PIN
#define A_MS1_PIN X_MS1_PIN
#define A_APPLY_DIR(v,Q) X_APPLY_DIR(v,Q)
#define A_APPLY_STEP(v,Q) X_APPLY_STEP(v,Q)

#define B_ENABLE_PIN Y_ENABLE_PIN
#define B_DIR_PIN Y_DIR_PIN
#define B_STEP_PIN Y_STEP_PIN
#define B_MS1_PIN Y_MS1_PIN
#define B_APPLY_DIR(v,Q) Y_APPLY_DIR(v,Q)
#define B_APPLY_STEP(v,Q) Y_APPLY_STEP(v,Q)

#define C_ENABLE_PIN Z_ENABLE_PIN
#define C_DIR_PIN Z_DIR_PIN
#define C_STEP_PIN Z_STEP_PIN
#define C_MS1_PIN Z_MS1_PIN
#define C_APPLY_DIR(v,Q) Z_APPLY_DIR(v,Q)
#define C_APPLY_STEP(v,Q) Z_APPLY_STEP(v,Q)

#if EXTRUDERS < 2
#define D_ENABLE_PIN E1_ENABLE_PIN
#define D_DIR_PIN E1_DIR_PIN
#define D_STEP_PIN E1_STEP_PIN
#define D_MS1_PIN E1_MS1_PIN
#define D_APPLY_DIR(v,Q) E1_DIR_WRITE(v)
#define D_APPLY_STEP(v,Q) E1_STEP_WRITE(v)
#elif EXTRUDERS == 2
#define D_ENABLE_PIN E2_ENABLE_PIN
#define D_DIR_PIN E2_DIR_PIN
#define D_STEP_PIN E2_STEP_PIN
#define D_MS1_PIN E2_MS1_PIN
#define D_APPLY_DIR(v,Q) E2_DIR_WRITE(v)
#define D_APPLY_STEP(v,Q) E2_STEP_WRITE(v)
#elif EXTRUDERS == 3
#define D_ENABLE_PIN E3_ENABLE_PIN
#define D_DIR_PIN E3_DIR_PIN
#define D_STEP_PIN E3_STEP_PIN
#define D_MS1_PIN E3_MS1_PIN
#define D_APPLY_DIR(v,Q) E3_DIR_WRITE(v)
#define D_APPLY_STEP(v,Q) E3_STEP_WRITE(v)
#elif EXTRUDERS == 4
#define D_ENABLE_PIN E4_ENABLE_PIN
#define D_DIR_PIN E4_DIR_PIN
#define D_STEP_PIN E4_STEP_PIN
#define D_MS1_PIN E4_MS1_PIN
#define D_APPLY_DIR(v,Q) E4_DIR_WRITE(v)
#define D_APPLY_STEP(v,Q) E4_STEP_WRITE(v)
#endif // EXTRUDERS
#define __D_APPLY(I,T,v) E##I##_##T##_WRITE(v)
#define _D_APPLY(I,T,v) __D_APPLY(I,T,v)
#define D_APPLY_DIR(v,Q) _D_APPLY(EXTRUDERS, DIR, v)
#define D_APPLY_STEP(v,Q) _D_APPLY(EXTRUDERS, STEP, v)
#endif

#if DISABLED(MIXING_EXTRUDER)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.