Browse Source

Fix LIN_ADVANCE + SWITCHING_EXTRUDER

Followup to #10656
pull/1/head
Scott Lahteine 7 years ago
parent
commit
65270d6a96
  1. 56
      Marlin/src/module/stepper.cpp

56
Marlin/src/module/stepper.cpp

@ -1646,29 +1646,51 @@ void Stepper::isr() {
#elif ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) #elif ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#define SET_E_STEP_DIR(INDEX) do{ if (e_steps) { if (e_steps < 0) REV_E_DIR(); else NORM_E_DIR(); } }while(0) #define SET_E_STEP_DIR(INDEX) do{ if (e_steps) { if (e_steps < 0) REV_E_DIR(); else NORM_E_DIR(); } }while(0)
#elif ENABLED(SWITCHING_EXTRUDER) #elif ENABLED(SWITCHING_EXTRUDER)
#define SET_E_STEP_DIR(INDEX) do{ if (e_steps) { switch (INDEX) { \ #if EXTRUDERS > 4
case 0: case 1: E0_DIR_WRITE(!INVERT_E0_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); break; \ #define SET_E_STEP_DIR(INDEX) do{ if (e_steps) { switch (INDEX) { \
case 2: case 3: E1_DIR_WRITE(!INVERT_E1_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); break; \ case 0: case 1: E0_DIR_WRITE(!INVERT_E0_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); break; \
case 4: E2_DIR_WRITE(!INVERT_E2_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); \ case 2: case 3: E1_DIR_WRITE(!INVERT_E1_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); break; \
} } }while(0) case 4: E2_DIR_WRITE(!INVERT_E2_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); \
} } }while(0)
#elif EXTRUDERS > 2
#define SET_E_STEP_DIR(INDEX) do{ if (e_steps) { switch (INDEX) { \
case 0: case 1: E0_DIR_WRITE(!INVERT_E0_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); break; \
case 2: case 3: E1_DIR_WRITE(!INVERT_E1_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); break; \
} } }while(0)
#else
#define SET_E_STEP_DIR(INDEX) do{ if (e_steps) E0_DIR_WRITE(!INVERT_E0_DIR ^ TEST(INDEX, 0) ^ (e_steps < 0)); }while(0)
#endif
#else #else
#define SET_E_STEP_DIR(INDEX) do{ if (e_steps) E## INDEX ##_DIR_WRITE(e_steps < 0 ? INVERT_E## INDEX ##_DIR : !INVERT_E## INDEX ##_DIR); }while(0) #define SET_E_STEP_DIR(INDEX) do{ if (e_steps) E## INDEX ##_DIR_WRITE(!INVERT_E## INDEX ##_DIR ^ (e_steps < 0)); }while(0)
#endif #endif
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#define START_E_PULSE(INDEX) do{ if (e_steps) E_STEP_WRITE(!INVERT_E_STEP_PIN); }while(0) #define START_E_PULSE(INDEX) do{ if (e_steps) E_STEP_WRITE(!INVERT_E_STEP_PIN); }while(0)
#define STOP_E_PULSE(INDEX) do{ if (e_steps) { E_STEP_WRITE(INVERT_E_STEP_PIN); e_steps < 0 ? ++e_steps : --e_steps; } }while(0) #define STOP_E_PULSE(INDEX) do{ if (e_steps) { e_steps < 0 ? ++e_steps : --e_steps; E_STEP_WRITE(INVERT_E_STEP_PIN); } }while(0)
#elif ENABLED(SWITCHING_EXTRUDER) #elif ENABLED(SWITCHING_EXTRUDER)
#define START_E_PULSE(INDEX) do{ if (e_steps) { switch (INDEX) { \ #if EXTRUDERS > 4
case 0: case 1: E0_DIR_WRITE(!INVERT_E_STEP_PIN); break; \ #define START_E_PULSE(INDEX) do{ if (e_steps) { switch (INDEX) { \
case 2: case 3: E1_DIR_WRITE(!INVERT_E_STEP_PIN); break; \ case 0: case 1: E0_DIR_WRITE(!INVERT_E_STEP_PIN); break; \
case 4: E2_DIR_WRITE(!INVERT_E_STEP_PIN); \ case 2: case 3: E1_DIR_WRITE(!INVERT_E_STEP_PIN); break; \
} } }while(0) case 4: E2_DIR_WRITE(!INVERT_E_STEP_PIN); } \
#define STOP_E_PULSE(INDEX) do{ if (e_steps) { switch (INDEX) { \ } }while(0)
case 0: case 1: E0_DIR_WRITE(!INVERT_E_STEP_PIN); break; \ #define STOP_E_PULSE(INDEX) do{ if (e_steps) { \
case 2: case 3: E1_DIR_WRITE(!INVERT_E_STEP_PIN); break; \ e_steps < 0 ? ++e_steps : --e_steps; \
case 4: E2_DIR_WRITE(!INVERT_E_STEP_PIN); \ switch (INDEX) { \
} } }while(0) case 0: case 1: E0_DIR_WRITE(INVERT_E_STEP_PIN); break; \
case 2: case 3: E1_DIR_WRITE(INVERT_E_STEP_PIN); break; \
case 4: E2_DIR_WRITE(INVERT_E_STEP_PIN); } \
} }while(0)
#elif EXTRUDERS > 2
#define START_E_PULSE(INDEX) do{ if (e_steps) { if (INDEX < 2) E0_DIR_WRITE(!INVERT_E_STEP_PIN); else E1_DIR_WRITE(!INVERT_E_STEP_PIN); } }while(0)
#define STOP_E_PULSE(INDEX) do{ if (e_steps) { \
e_steps < 0 ? ++e_steps : --e_steps; \
if (INDEX < 2) E0_DIR_WRITE(INVERT_E_STEP_PIN); else E1_DIR_WRITE(INVERT_E_STEP_PIN); \
} }while(0)
#else
#define START_E_PULSE(INDEX) do{ if (e_steps) E0_DIR_WRITE(!INVERT_E_STEP_PIN); }while(0)
#define STOP_E_PULSE(INDEX) do{ if (e_steps) { e_steps < 0 ? ++e_steps : --e_steps; E0_DIR_WRITE(INVERT_E_STEP_PIN); }while(0)
#endif
#else #else
#define START_E_PULSE(INDEX) do{ if (e_steps) E## INDEX ##_STEP_WRITE(!INVERT_E_STEP_PIN); }while(0) #define START_E_PULSE(INDEX) do{ if (e_steps) E## INDEX ##_STEP_WRITE(!INVERT_E_STEP_PIN); }while(0)
#define STOP_E_PULSE(INDEX) do { if (e_steps) { e_steps < 0 ? ++e_steps : --e_steps; E## INDEX ##_STEP_WRITE(INVERT_E_STEP_PIN); } }while(0) #define STOP_E_PULSE(INDEX) do { if (e_steps) { e_steps < 0 ? ++e_steps : --e_steps; E## INDEX ##_STEP_WRITE(INVERT_E_STEP_PIN); } }while(0)

Loading…
Cancel
Save