0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-18 23:49:49 +00:00

🎨 NORM_E_DIR => FWD_E_DIR

This commit is contained in:
Scott Lahteine 2023-04-29 20:20:49 -05:00
parent 5abb594f01
commit 573bc7344b
3 changed files with 63 additions and 61 deletions

View file

@ -866,36 +866,38 @@ void Endstops::update() {
// Signal, after validation, if an endstop limit is pressed or not // Signal, after validation, if an endstop limit is pressed or not
if (stepper.axis_is_moving(X_AXIS)) { #if HAS_X_AXIS
if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction if (stepper.axis_is_moving(X_AXIS)) {
#if HAS_X_MIN || (X_SPI_SENSORLESS && X_HOME_TO_MIN) if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction
PROCESS_ENDSTOP_X(MIN); #if HAS_X_MIN || (X_SPI_SENSORLESS && X_HOME_TO_MIN)
#if CORE_DIAG(XY, Y, MIN) PROCESS_ENDSTOP_X(MIN);
PROCESS_CORE_ENDSTOP(Y,MIN,X,MIN); #if CORE_DIAG(XY, Y, MIN)
#elif CORE_DIAG(XY, Y, MAX) PROCESS_CORE_ENDSTOP(Y,MIN,X,MIN);
PROCESS_CORE_ENDSTOP(Y,MAX,X,MIN); #elif CORE_DIAG(XY, Y, MAX)
#elif CORE_DIAG(XZ, Z, MIN) PROCESS_CORE_ENDSTOP(Y,MAX,X,MIN);
PROCESS_CORE_ENDSTOP(Z,MIN,X,MIN); #elif CORE_DIAG(XZ, Z, MIN)
#elif CORE_DIAG(XZ, Z, MAX) PROCESS_CORE_ENDSTOP(Z,MIN,X,MIN);
PROCESS_CORE_ENDSTOP(Z,MAX,X,MIN); #elif CORE_DIAG(XZ, Z, MAX)
PROCESS_CORE_ENDSTOP(Z,MAX,X,MIN);
#endif
#endif #endif
#endif }
} else { // +direction
else { // +direction #if HAS_X_MAX || (X_SPI_SENSORLESS && X_HOME_TO_MAX)
#if HAS_X_MAX || (X_SPI_SENSORLESS && X_HOME_TO_MAX) PROCESS_ENDSTOP_X(MAX);
PROCESS_ENDSTOP_X(MAX); #if CORE_DIAG(XY, Y, MIN)
#if CORE_DIAG(XY, Y, MIN) PROCESS_CORE_ENDSTOP(Y,MIN,X,MAX);
PROCESS_CORE_ENDSTOP(Y,MIN,X,MAX); #elif CORE_DIAG(XY, Y, MAX)
#elif CORE_DIAG(XY, Y, MAX) PROCESS_CORE_ENDSTOP(Y,MAX,X,MAX);
PROCESS_CORE_ENDSTOP(Y,MAX,X,MAX); #elif CORE_DIAG(XZ, Z, MIN)
#elif CORE_DIAG(XZ, Z, MIN) PROCESS_CORE_ENDSTOP(Z,MIN,X,MAX);
PROCESS_CORE_ENDSTOP(Z,MIN,X,MAX); #elif CORE_DIAG(XZ, Z, MAX)
#elif CORE_DIAG(XZ, Z, MAX) PROCESS_CORE_ENDSTOP(Z,MAX,X,MAX);
PROCESS_CORE_ENDSTOP(Z,MAX,X,MAX); #endif
#endif #endif
#endif }
} }
} #endif // HAS_X_AXIS
#if HAS_Y_AXIS #if HAS_Y_AXIS
if (stepper.axis_is_moving(Y_AXIS)) { if (stepper.axis_is_moving(Y_AXIS)) {
@ -928,7 +930,7 @@ void Endstops::update() {
#endif #endif
} }
} }
#endif #endif // HAS_Y_AXIS
#if HAS_Z_AXIS #if HAS_Z_AXIS
if (stepper.axis_is_moving(Z_AXIS)) { if (stepper.axis_is_moving(Z_AXIS)) {
@ -973,7 +975,7 @@ void Endstops::update() {
#endif #endif
} }
} }
#endif #endif // HAS_Z_AXIS
#if HAS_I_AXIS #if HAS_I_AXIS
if (stepper.axis_is_moving(I_AXIS)) { if (stepper.axis_is_moving(I_AXIS)) {
@ -988,7 +990,7 @@ void Endstops::update() {
#endif #endif
} }
} }
#endif #endif // HAS_I_AXIS
#if HAS_J_AXIS #if HAS_J_AXIS
if (stepper.axis_is_moving(J_AXIS)) { if (stepper.axis_is_moving(J_AXIS)) {
@ -1003,7 +1005,7 @@ void Endstops::update() {
#endif #endif
} }
} }
#endif #endif // HAS_J_AXIS
#if HAS_K_AXIS #if HAS_K_AXIS
if (stepper.axis_is_moving(K_AXIS)) { if (stepper.axis_is_moving(K_AXIS)) {
@ -1018,7 +1020,7 @@ void Endstops::update() {
#endif #endif
} }
} }
#endif #endif // HAS_K_AXIS
#if HAS_U_AXIS #if HAS_U_AXIS
if (stepper.axis_is_moving(U_AXIS)) { if (stepper.axis_is_moving(U_AXIS)) {
@ -1033,7 +1035,7 @@ void Endstops::update() {
#endif #endif
} }
} }
#endif #endif // HAS_U_AXIS
#if HAS_V_AXIS #if HAS_V_AXIS
if (stepper.axis_is_moving(V_AXIS)) { if (stepper.axis_is_moving(V_AXIS)) {
@ -1048,7 +1050,7 @@ void Endstops::update() {
#endif #endif
} }
} }
#endif #endif // HAS_V_AXIS
#if HAS_W_AXIS #if HAS_W_AXIS
if (stepper.axis_is_moving(W_AXIS)) { if (stepper.axis_is_moving(W_AXIS)) {
@ -1063,7 +1065,7 @@ void Endstops::update() {
#endif #endif
} }
} }
#endif #endif // HAS_W_AXIS
} // Endstops::update() } // Endstops::update()
#if ENABLED(SPI_ENDSTOPS) #if ENABLED(SPI_ENDSTOPS)

View file

@ -636,9 +636,9 @@ void Stepper::apply_directions() {
} }
else { else {
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); MIXER_STEPPER_LOOP(j) FWD_E_DIR(j);
#else #else
NORM_E_DIR(stepper_extruder); FWD_E_DIR(stepper_extruder);
#endif #endif
count_direction.e = 1; count_direction.e = 1;
} }
@ -2420,9 +2420,9 @@ hal_timer_t Stepper::block_phase_isr() {
} }
else { else {
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); MIXER_STEPPER_LOOP(j) FWD_E_DIR(j);
#else #else
NORM_E_DIR(stepper_extruder); FWD_E_DIR(stepper_extruder);
#endif #endif
} }

View file

@ -459,7 +459,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#if HAS_SWITCHING_EXTRUDER // One stepper driver per two extruders, reversed on odd index #if HAS_SWITCHING_EXTRUDER // One stepper driver per two extruders, reversed on odd index
#if EXTRUDERS > 7 #if EXTRUDERS > 7
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0) #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \ #define FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \
case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \ case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \
case 4: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 5: E2_DIR_WRITE(INVERT_DIR(E2, LOW )); break; \ case 4: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 5: E2_DIR_WRITE(INVERT_DIR(E2, LOW )); break; \
@ -473,7 +473,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
} }while(0) } }while(0)
#elif EXTRUDERS > 6 #elif EXTRUDERS > 6
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0) #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \ #define FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \
case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \ case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \
case 4: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 5: E2_DIR_WRITE(INVERT_DIR(E2, LOW )); break; \ case 4: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 5: E2_DIR_WRITE(INVERT_DIR(E2, LOW )); break; \
@ -486,7 +486,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 6: E3_DIR_WRITE(INVERT_DIR(E3, LOW )); } }while(0) case 6: E3_DIR_WRITE(INVERT_DIR(E3, LOW )); } }while(0)
#elif EXTRUDERS > 5 #elif EXTRUDERS > 5
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0) #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \ #define FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \
case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \ case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \
case 4: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 5: E2_DIR_WRITE(INVERT_DIR(E2, LOW )); break; \ case 4: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 5: E2_DIR_WRITE(INVERT_DIR(E2, LOW )); break; \
@ -498,7 +498,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
} }while(0) } }while(0)
#elif EXTRUDERS > 4 #elif EXTRUDERS > 4
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0) #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \ #define FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \
case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \ case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \
case 4: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; \ case 4: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; \
@ -510,7 +510,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
} }while(0) } }while(0)
#elif EXTRUDERS > 3 #elif EXTRUDERS > 3
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0) #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \ #define FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \
case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \ case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 3: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; \
} }while(0) } }while(0)
@ -520,7 +520,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
} }while(0) } }while(0)
#elif EXTRUDERS > 2 #elif EXTRUDERS > 2
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0) #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \ #define FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; \
case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \ case 2: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \
} }while(0) } }while(0)
@ -530,20 +530,20 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
} }while(0) } }while(0)
#else #else
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(INVERT_DIR(E0, (E) ? LOW : HIGH)); }while(0) #define FWD_E_DIR(E) do{ E0_DIR_WRITE(INVERT_DIR(E0, (E) ? LOW : HIGH)); }while(0)
#define REV_E_DIR(E) do{ E0_DIR_WRITE(INVERT_DIR(E0, (E) ? HIGH : LOW )); }while(0) #define REV_E_DIR(E) do{ E0_DIR_WRITE(INVERT_DIR(E0, (E) ? HIGH : LOW )); }while(0)
#endif #endif
#elif HAS_PRUSA_MMU2 // One multiplexed stepper driver #elif HAS_PRUSA_MMU2 // One multiplexed stepper driver
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
#define NORM_E_DIR(E) E0_DIR_WRITE(INVERT_DIR(E0, HIGH)) #define FWD_E_DIR(E) E0_DIR_WRITE(INVERT_DIR(E0, HIGH))
#define REV_E_DIR(E) E0_DIR_WRITE(INVERT_DIR(E0, LOW )) #define REV_E_DIR(E) E0_DIR_WRITE(INVERT_DIR(E0, LOW ))
#elif HAS_PRUSA_MMU1 // One multiplexed stepper driver, reversed on odd index #elif HAS_PRUSA_MMU1 // One multiplexed stepper driver, reversed on odd index
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(INVERT_DIR(E0, TEST(E, 0) ? HIGH : LOW )); }while(0) #define FWD_E_DIR(E) do{ E0_DIR_WRITE(INVERT_DIR(E0, TEST(E, 0) ? HIGH : LOW )); }while(0)
#define REV_E_DIR(E) do{ E0_DIR_WRITE(INVERT_DIR(E0, TEST(E, 0) ? LOW : HIGH)); }while(0) #define REV_E_DIR(E) do{ E0_DIR_WRITE(INVERT_DIR(E0, TEST(E, 0) ? LOW : HIGH)); }while(0)
#elif E_STEPPERS > 1 #elif E_STEPPERS > 1
@ -554,7 +554,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \ case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \
case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; case 7: E7_STEP_WRITE(V); break; \ case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; case 7: E7_STEP_WRITE(V); break; \
} }while(0) } }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \ #define _FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \
case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \ case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \
case 4: E4_DIR_WRITE(INVERT_DIR(E4, HIGH)); break; case 5: E5_DIR_WRITE(INVERT_DIR(E5, HIGH)); break; \ case 4: E4_DIR_WRITE(INVERT_DIR(E4, HIGH)); break; case 5: E5_DIR_WRITE(INVERT_DIR(E5, HIGH)); break; \
@ -573,7 +573,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \ case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \
case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; \ case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; \
} }while(0) } }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \ #define _FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \
case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \ case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \
case 4: E4_DIR_WRITE(INVERT_DIR(E4, HIGH)); break; case 5: E5_DIR_WRITE(INVERT_DIR(E5, HIGH)); break; \ case 4: E4_DIR_WRITE(INVERT_DIR(E4, HIGH)); break; case 5: E5_DIR_WRITE(INVERT_DIR(E5, HIGH)); break; \
@ -592,7 +592,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \ case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \
case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; \ case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; \
} }while(0) } }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \ #define _FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \
case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \ case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \
case 4: E4_DIR_WRITE(INVERT_DIR(E4, HIGH)); break; case 5: E5_DIR_WRITE(INVERT_DIR(E5, HIGH)); break; \ case 4: E4_DIR_WRITE(INVERT_DIR(E4, HIGH)); break; case 5: E5_DIR_WRITE(INVERT_DIR(E5, HIGH)); break; \
@ -609,7 +609,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \ case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \
case 4: E4_STEP_WRITE(V); break; \ case 4: E4_STEP_WRITE(V); break; \
} }while(0) } }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \ #define _FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \
case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \ case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \
case 4: E4_DIR_WRITE(INVERT_DIR(E4, HIGH)); break; \ case 4: E4_DIR_WRITE(INVERT_DIR(E4, HIGH)); break; \
@ -625,7 +625,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define _E_STEP_WRITE(E,V) do{ switch (E) { \ #define _E_STEP_WRITE(E,V) do{ switch (E) { \
case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \ case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \
} }while(0) } }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \ #define _FWD_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \ case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; \
case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \ case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); break; case 3: E3_DIR_WRITE(INVERT_DIR(E3, HIGH)); break; \
} }while(0) } }while(0)
@ -637,13 +637,13 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#elif E_STEPPERS > 2 #elif E_STEPPERS > 2
#define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); } }while(0) #define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); } }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); } }while(0) #define _FWD_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); break; case 2: E2_DIR_WRITE(INVERT_DIR(E2, HIGH)); } }while(0)
#define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; case 2: E2_DIR_WRITE(INVERT_DIR(E2, LOW )); } }while(0) #define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(INVERT_DIR(E0, LOW )); break; case 1: E1_DIR_WRITE(INVERT_DIR(E1, LOW )); break; case 2: E2_DIR_WRITE(INVERT_DIR(E2, LOW )); } }while(0)
#else #else
#define _E_STEP_WRITE(E,V) do{ if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0) #define _E_STEP_WRITE(E,V) do{ if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
#define _NORM_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); } else { E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); } }while(0) #define _FWD_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(INVERT_DIR(E0, HIGH)); } else { E1_DIR_WRITE(INVERT_DIR(E1, HIGH)); } }while(0)
#define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(INVERT_DIR(E0, LOW )); } else { E1_DIR_WRITE(INVERT_DIR(E1, LOW )); } }while(0) #define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(INVERT_DIR(E0, LOW )); } else { E1_DIR_WRITE(INVERT_DIR(E1, LOW )); } }while(0)
#endif #endif
@ -659,30 +659,30 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define RDIR(N) DUPE(N,DIR,INVERT_DIR(E, LOW )); #define RDIR(N) DUPE(N,DIR,INVERT_DIR(E, LOW ));
#define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { REPEAT2(E_STEPPERS, DUPE, STEP, V); } else _E_STEP_WRITE(E,V); }while(0) #define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { REPEAT2(E_STEPPERS, DUPE, STEP, V); } else _E_STEP_WRITE(E,V); }while(0)
#define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { REPEAT(E_STEPPERS, NDIR); } else _NORM_E_DIR(E); }while(0) #define FWD_E_DIR(E) do{ if (extruder_duplication_enabled) { REPEAT(E_STEPPERS, NDIR); } else _FWD_E_DIR(E); }while(0)
#define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { REPEAT(E_STEPPERS, RDIR); } else _REV_E_DIR(E); }while(0) #define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { REPEAT(E_STEPPERS, RDIR); } else _REV_E_DIR(E); }while(0)
#else #else
#define E_STEP_WRITE(E,V) _E_STEP_WRITE(E,V) #define E_STEP_WRITE(E,V) _E_STEP_WRITE(E,V)
#define NORM_E_DIR(E) _NORM_E_DIR(E) #define FWD_E_DIR(E) _FWD_E_DIR(E)
#define REV_E_DIR(E) _REV_E_DIR(E) #define REV_E_DIR(E) _REV_E_DIR(E)
#endif #endif
#elif ENABLED(E_DUAL_STEPPER_DRIVERS) #elif ENABLED(E_DUAL_STEPPER_DRIVERS)
#define E_STEP_WRITE(E,V) do{ E0_STEP_WRITE(V); E1_STEP_WRITE(V); }while(0) #define E_STEP_WRITE(E,V) do{ E0_STEP_WRITE(V); E1_STEP_WRITE(V); }while(0)
#define NORM_E_DIR(E) do{ constexpr bool d = INVERT_DIR(E0, HIGH); E0_DIR_WRITE(d); E1_DIR_WRITE(INVERT_DIR(E1_VS_E0, d)); }while(0) #define FWD_E_DIR(E) do{ constexpr bool d = INVERT_DIR(E0, HIGH); E0_DIR_WRITE(d); E1_DIR_WRITE(INVERT_DIR(E1_VS_E0, d)); }while(0)
#define REV_E_DIR(E) do{ constexpr bool d = INVERT_DIR(E0, LOW ); E0_DIR_WRITE(d); E1_DIR_WRITE(INVERT_DIR(E1_VS_E0, d)); }while(0) #define REV_E_DIR(E) do{ constexpr bool d = INVERT_DIR(E0, LOW ); E0_DIR_WRITE(d); E1_DIR_WRITE(INVERT_DIR(E1_VS_E0, d)); }while(0)
#elif E_STEPPERS #elif E_STEPPERS
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
#define NORM_E_DIR(E) E0_DIR_WRITE(INVERT_DIR(E0, HIGH)) #define FWD_E_DIR(E) E0_DIR_WRITE(INVERT_DIR(E0, HIGH))
#define REV_E_DIR(E) E0_DIR_WRITE(INVERT_DIR(E0, LOW )) #define REV_E_DIR(E) E0_DIR_WRITE(INVERT_DIR(E0, LOW ))
#else #else
#define E_STEP_WRITE(E,V) NOOP #define E_STEP_WRITE(E,V) NOOP
#define NORM_E_DIR(E) NOOP #define FWD_E_DIR(E) NOOP
#define REV_E_DIR(E) NOOP #define REV_E_DIR(E) NOOP
#endif #endif