From 5b1ef638ee9630063de0cc096cd408c871e5b72f Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Tue, 12 Oct 2021 19:40:56 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20IDEX=20+=20DISABLE=5FINACT?= =?UTF-8?q?IVE=5FEXTRUDER=20(#22925)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/motion.cpp | 1 + Marlin/src/module/planner.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index f5dd5d34c9..71239501fd 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -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; diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index e62a9ab5ee..b89a313f2b 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -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