Skip to content

Commit

Permalink
🐛 Fix IDEX + DISABLE_INACTIVE_EXTRUDER (#22925)
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanityAutomation authored Oct 12, 2021
1 parent 769948b commit 15ebe45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
case DXC_MIRRORED_MODE:
case DXC_DUPLICATION_MODE:
if (active_extruder == 0) {
set_duplication_enabled(false); // Clear stale duplication state
// Restore planner to parked head (T1) X position
float x0_pos = current_position.x;
xyze_pos_t pos_now = current_position;
Expand Down
20 changes: 10 additions & 10 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2207,23 +2207,23 @@ bool Planner::_populate_block(block_t * const block, bool split_move,

#if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder

// Count down all steppers that were recently moved
LOOP_L_N(i, E_STEPPERS)
if (g_uc_extruder_last_move[i]) g_uc_extruder_last_move[i]--;

// Switching Extruder uses one E stepper motor per two nozzles
#define E_STEPPER_INDEX(E) TERN(SWITCHING_EXTRUDER, (E) / 2, E)

// Enable all (i.e., both) E steppers for IDEX-style duplication, but only active E steppers for multi-nozzle (i.e., single wide X carriage) duplication
#define _IS_DUPE(N) TERN0(HAS_DUPLICATION_MODE, (extruder_duplication_enabled && TERN1(MULTI_NOZZLE_DUPLICATION, TEST(duplication_e_mask, N))))

#define ENABLE_ONE_E(N) do{ \
if (E_STEPPER_INDEX(extruder) == N) { \
stepper.ENABLE_EXTRUDER(N); \
g_uc_extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; \
if ((N) == 0 && TERN0(HAS_DUPLICATION_MODE, extruder_duplication_enabled)) \
stepper.ENABLE_EXTRUDER(1); \
} \
else if (!g_uc_extruder_last_move[N]) { \
stepper.DISABLE_EXTRUDER(N); \
if ((N) == 0 && TERN0(HAS_DUPLICATION_MODE, extruder_duplication_enabled)) \
stepper.DISABLE_EXTRUDER(1); \
if (N == E_STEPPER_INDEX(extruder) || _IS_DUPE(N)) { /* N is 'extruder', or N is duplicating */ \
stepper.ENABLE_EXTRUDER(N); /* Enable the relevant E stepper... */ \
g_uc_extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; /* ...and reset its counter */ \
} \
else if (!g_uc_extruder_last_move[N]) /* Counter expired since last E stepper enable */ \
stepper.DISABLE_EXTRUDER(N); /* Disable the E stepper */ \
}while(0);

#else
Expand Down

0 comments on commit 15ebe45

Please sign in to comment.