Fix stepper direction macros, multi-nozzle scope (#13569)

This commit is contained in:
InsanityAutomation 2019-04-04 03:44:07 -04:00 committed by Scott Lahteine
parent 10b9632bed
commit d44e5b1fde
3 changed files with 17 additions and 14 deletions

View File

@ -859,11 +859,10 @@ void clean_up_after_endstop_or_probe_move() {
#if HAS_DUPLICATION_MODE
bool extruder_duplication_enabled,
mirrored_duplication_mode;
#endif
#if ENABLED(MULTI_NOZZLE_DUPLICATION) && HOTENDS > 2
#if ENABLED(MULTI_NOZZLE_DUPLICATION)
uint8_t duplication_e_mask; // = 0
#endif
#endif
#if ENABLED(DUAL_X_CARRIAGE)

View File

@ -318,10 +318,9 @@ void homeaxis(const AxisEnum axis);
#if HAS_DUPLICATION_MODE
extern bool extruder_duplication_enabled, // Used in Dual X mode 2
mirrored_duplication_mode; // Used in Dual X mode 3
#if ENABLED(MULTI_NOZZLE_DUPLICATION)
extern uint8_t duplication_e_mask;
#endif
#if ENABLED(MULTI_NOZZLE_DUPLICATION) && HOTENDS > 2
uint8_t duplication_e_mask;
#endif
/**

View File

@ -618,14 +618,20 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0)
#endif
#if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION)
#if HAS_DUPLICATION_MODE
#if ENABLED(MULTI_NOZZLE_DUPLICATION)
#define _DUPE(N,T,V) do{ if (TEST(duplication_e_mask, N)) E##N##_##T##_WRITE(V); }while(0)
#else
#define _DUPE(N,T,V) E##N##_##T##_WRITE(V)
#endif
#define NDIR(N) _DUPE(N,DIR,!INVERT_E##N##_DIR)
#define RDIR(N) _DUPE(N,DIR, INVERT_E##N##_DIR)
#define NDIR(N) _DUPE(DIR,!INVERT_E##N##_DIR)
#define RDIR(N) _DUPE(DIR, INVERT_E##N##_DIR)
#define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { DUPE(STEP,V); } else _E_STEP_WRITE(E,V); }while(0)
#if E_STEPPERS > 2
#define _DUPE(N,T,V) do{ if (duplication_e_mask <= (N)) E##N##_##T##_WRITE(V); }while(0)
#if E_STEPPERS > 5
#define DUPE(T,V) do{ _DUPE(0,T,V); _DUPE(1,T,V); _DUPE(2,T,V); _DUPE(3,T,V); _DUPE(4,T,V); _DUPE(5,T,V); }while(0)
#define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); NDIR(2); NDIR(3); NDIR(4); NDIR(5); } else _NORM_E_DIR(E); }while(0)
@ -644,8 +650,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); RDIR(2); } else _REV_E_DIR(E); }while(0)
#endif
#else
#define _DUPE(T,V) do{ E0_##T##_WRITE(V); E1_##T##_WRITE(V); }while(0)
#define DUPE(T,V) _DUPE(T,V)
#define DUPE(T,V) do{ _DUPE(0,T,V); _DUPE(1,T,V); } while(0)
#define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); } else _NORM_E_DIR(E); }while(0)
#define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); } else _REV_E_DIR(E); }while(0)
#endif