Skip to content

Commit

Permalink
🔧 Overridable Stepper EN init
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 7, 2023
1 parent b7e4216 commit 2c39f84
Showing 1 changed file with 52 additions and 16 deletions.
68 changes: 52 additions & 16 deletions Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2776,35 +2776,44 @@ void Stepper::init() {

// Init Enable Pins - steppers default to disabled.
#if HAS_X_ENABLE
#ifndef X_ENABLE_INIT_STATE
#define X_ENABLE_INIT_STATE !X_ENABLE_ON
#endif
X_ENABLE_INIT();
if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH);
if (X_ENABLE_INIT_STATE) X_ENABLE_WRITE(X_ENABLE_INIT_STATE);
#if BOTH(HAS_X2_STEPPER, HAS_X2_ENABLE)
X2_ENABLE_INIT();
if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH);
if (X_ENABLE_INIT_STATE) X2_ENABLE_WRITE(X_ENABLE_INIT_STATE);
#endif
#endif
#if HAS_Y_ENABLE
#ifndef Y_ENABLE_INIT_STATE
#define Y_ENABLE_INIT_STATE !Y_ENABLE_ON
#endif
Y_ENABLE_INIT();
if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
if (Y_ENABLE_INIT_STATE) Y_ENABLE_WRITE(Y_ENABLE_INIT_STATE);
#if BOTH(HAS_DUAL_Y_STEPPERS, HAS_Y2_ENABLE)
Y2_ENABLE_INIT();
if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
if (Y_ENABLE_INIT_STATE) Y2_ENABLE_WRITE(Y_ENABLE_INIT_STATE);
#endif
#endif
#if HAS_Z_ENABLE
#ifndef Z_ENABLE_INIT_STATE
#define Z_ENABLE_INIT_STATE !Z_ENABLE_ON
#endif
Z_ENABLE_INIT();
if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH);
if (Z_ENABLE_INIT_STATE) Z_ENABLE_WRITE(Z_ENABLE_INIT_STATE);
#if NUM_Z_STEPPERS >= 2 && HAS_Z2_ENABLE
Z2_ENABLE_INIT();
if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
if (Z_ENABLE_INIT_STATE) Z2_ENABLE_WRITE(Z_ENABLE_INIT_STATE);
#endif
#if NUM_Z_STEPPERS >= 3 && HAS_Z3_ENABLE
Z3_ENABLE_INIT();
if (!Z_ENABLE_ON) Z3_ENABLE_WRITE(HIGH);
if (Z_ENABLE_INIT_STATE) Z3_ENABLE_WRITE(Z_ENABLE_INIT_STATE);
#endif
#if NUM_Z_STEPPERS >= 4 && HAS_Z4_ENABLE
Z4_ENABLE_INIT();
if (!Z_ENABLE_ON) Z4_ENABLE_WRITE(HIGH);
if (Z_ENABLE_INIT_STATE) Z4_ENABLE_WRITE(Z_ENABLE_INIT_STATE);
#endif
#endif
#if HAS_I_ENABLE
Expand Down Expand Up @@ -2832,36 +2841,63 @@ void Stepper::init() {
if (!W_ENABLE_ON) W_ENABLE_WRITE(HIGH);
#endif
#if HAS_E0_ENABLE
#ifndef E_ENABLE_INIT_STATE
#define E_ENABLE_INIT_STATE !E_ENABLE_ON
#endif
#ifndef E0_ENABLE_INIT_STATE
#define E0_ENABLE_INIT_STATE E_ENABLE_INIT_STATE
#endif
E0_ENABLE_INIT();
if (!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH);
if (E0_ENABLE_INIT_STATE) E0_ENABLE_WRITE(E0_ENABLE_INIT_STATE);
#endif
#if HAS_E1_ENABLE
#ifndef E1_ENABLE_INIT_STATE
#define E1_ENABLE_INIT_STATE E_ENABLE_INIT_STATE
#endif
E1_ENABLE_INIT();
if (!E_ENABLE_ON) E1_ENABLE_WRITE(HIGH);
if (E1_ENABLE_INIT_STATE) E1_ENABLE_WRITE(E1_ENABLE_INIT_STATE);
#endif
#if HAS_E2_ENABLE
#ifndef E2_ENABLE_INIT_STATE
#define E2_ENABLE_INIT_STATE E_ENABLE_INIT_STATE
#endif
E2_ENABLE_INIT();
if (!E_ENABLE_ON) E2_ENABLE_WRITE(HIGH);
if (E2_ENABLE_INIT_STATE) E2_ENABLE_WRITE(E2_ENABLE_INIT_STATE);
#endif
#if HAS_E3_ENABLE
#ifndef E3_ENABLE_INIT_STATE
#define E3_ENABLE_INIT_STATE E_ENABLE_INIT_STATE
#endif
E3_ENABLE_INIT();
if (!E_ENABLE_ON) E3_ENABLE_WRITE(HIGH);
if (E3_ENABLE_INIT_STATE) E3_ENABLE_WRITE(E3_ENABLE_INIT_STATE);
#endif
#if HAS_E4_ENABLE
#ifndef E4_ENABLE_INIT_STATE
#define E4_ENABLE_INIT_STATE E_ENABLE_INIT_STATE
#endif
E4_ENABLE_INIT();
if (!E_ENABLE_ON) E4_ENABLE_WRITE(HIGH);
if (E4_ENABLE_INIT_STATE) E4_ENABLE_WRITE(E4_ENABLE_INIT_STATE);
#endif
#if HAS_E5_ENABLE
#ifndef E5_ENABLE_INIT_STATE
#define E5_ENABLE_INIT_STATE E_ENABLE_INIT_STATE
#endif
E5_ENABLE_INIT();
if (!E_ENABLE_ON) E5_ENABLE_WRITE(HIGH);
if (E5_ENABLE_INIT_STATE) E5_ENABLE_WRITE(E5_ENABLE_INIT_STATE);
#endif
#if HAS_E6_ENABLE
#ifndef E6_ENABLE_INIT_STATE
#define E6_ENABLE_INIT_STATE E_ENABLE_INIT_STATE
#endif
E6_ENABLE_INIT();
if (!E_ENABLE_ON) E6_ENABLE_WRITE(HIGH);
if (E6_ENABLE_INIT_STATE) E6_ENABLE_WRITE(E6_ENABLE_INIT_STATE);
#endif
#if HAS_E7_ENABLE
#ifndef E7_ENABLE_INIT_STATE
#define E7_ENABLE_INIT_STATE E_ENABLE_INIT_STATE
#endif
E7_ENABLE_INIT();
if (!E_ENABLE_ON) E7_ENABLE_WRITE(HIGH);
if (E7_ENABLE_INIT_STATE) E7_ENABLE_WRITE(E7_ENABLE_INIT_STATE);
#endif

#define _STEP_INIT(AXIS) AXIS ##_STEP_INIT()
Expand Down

0 comments on commit 2c39f84

Please sign in to comment.