From ac7e97f4feb8310681a330d757d414c132e6563a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 30 Mar 2018 15:07:11 -0500 Subject: [PATCH] Change order of inactive stepper disable/enable This ensures that steppers that share an enable pin will only be disabled for a miniscule time. --- Marlin/src/module/planner.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index f00798d992..7c8051770d 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -939,16 +939,8 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE] for (uint8_t i = 0; i < EXTRUDERS; i++) if (g_uc_extruder_last_move[i] > 0) g_uc_extruder_last_move[i]--; - switch(extruder) { + switch (extruder) { case 0: - enable_E0(); - g_uc_extruder_last_move[0] = (BLOCK_BUFFER_SIZE) * 2; - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) - if (extruder_duplication_enabled) { - enable_E1(); - g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2; - } - #endif #if EXTRUDERS > 1 DISABLE_IDLE_E(1); #if EXTRUDERS > 2 @@ -961,11 +953,17 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE] #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 #endif // EXTRUDERS > 1 + enable_E0(); + g_uc_extruder_last_move[0] = (BLOCK_BUFFER_SIZE) * 2; + #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + if (extruder_duplication_enabled) { + enable_E1(); + g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2; + } + #endif break; #if EXTRUDERS > 1 case 1: - enable_E1(); - g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2; DISABLE_IDLE_E(0); #if EXTRUDERS > 2 DISABLE_IDLE_E(2); @@ -976,11 +974,11 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE] #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 + enable_E1(); + g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2; break; #if EXTRUDERS > 2 case 2: - enable_E2(); - g_uc_extruder_last_move[2] = (BLOCK_BUFFER_SIZE) * 2; DISABLE_IDLE_E(0); DISABLE_IDLE_E(1); #if EXTRUDERS > 3 @@ -989,26 +987,28 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE] DISABLE_IDLE_E(4); #endif #endif + enable_E2(); + g_uc_extruder_last_move[2] = (BLOCK_BUFFER_SIZE) * 2; break; #if EXTRUDERS > 3 case 3: - enable_E3(); - g_uc_extruder_last_move[3] = (BLOCK_BUFFER_SIZE) * 2; DISABLE_IDLE_E(0); DISABLE_IDLE_E(1); DISABLE_IDLE_E(2); #if EXTRUDERS > 4 DISABLE_IDLE_E(4); #endif + enable_E3(); + g_uc_extruder_last_move[3] = (BLOCK_BUFFER_SIZE) * 2; break; #if EXTRUDERS > 4 case 4: - enable_E4(); - g_uc_extruder_last_move[4] = (BLOCK_BUFFER_SIZE) * 2; DISABLE_IDLE_E(0); DISABLE_IDLE_E(1); DISABLE_IDLE_E(2); DISABLE_IDLE_E(3); + enable_E4(); + g_uc_extruder_last_move[4] = (BLOCK_BUFFER_SIZE) * 2; break; #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3