From 80026729381685b3fd93bc1bf9bbabe9b6ac7d67 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 1 May 2017 12:20:25 -0500 Subject: [PATCH] Fixes for DUAL_NOZZLE_DUPLICATION_MODE --- Marlin/enum.h | 2 +- Marlin/planner.cpp | 46 ++++++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Marlin/enum.h b/Marlin/enum.h index 1e993e918..642e331b4 100644 --- a/Marlin/enum.h +++ b/Marlin/enum.h @@ -161,7 +161,7 @@ enum LCDViewAction { LCDVIEW_CALL_NO_REDRAW }; -#if ENABLED(DUAL_X_CARRIAGE) +#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) enum DualXMode { DXC_FULL_CONTROL_MODE, DXC_AUTO_PARK_MODE, diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 09631ba1d..2fb9996d4 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -131,7 +131,7 @@ float Planner::previous_speed[NUM_AXIS], #if ENABLED(DISABLE_INACTIVE_EXTRUDER) uint8_t Planner::g_uc_extruder_last_move[EXTRUDERS] = { 0 }; -#endif // DISABLE_INACTIVE_EXTRUDER +#endif #ifdef XY_FREQUENCY_LIMIT // Old direction bits. Used for speed calculations @@ -863,27 +863,29 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const #if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder + #define DISABLE_IDLE_E(N) if (!g_uc_extruder_last_move[N]) disable_E##N(); + for (uint8_t i = 0; i < EXTRUDERS; i++) if (g_uc_extruder_last_move[i] > 0) g_uc_extruder_last_move[i]--; 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 - g_uc_extruder_last_move[0] = (BLOCK_BUFFER_SIZE) * 2; #if EXTRUDERS > 1 - if (g_uc_extruder_last_move[1] == 0) disable_E1(); + DISABLE_IDLE_E(1); #if EXTRUDERS > 2 - if (g_uc_extruder_last_move[2] == 0) disable_E2(); + DISABLE_IDLE_E(2); #if EXTRUDERS > 3 - if (g_uc_extruder_last_move[3] == 0) disable_E3(); + DISABLE_IDLE_E(3); #if EXTRUDERS > 4 - if (g_uc_extruder_last_move[4] == 0) disable_E4(); + DISABLE_IDLE_E(4); #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 @@ -893,13 +895,13 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const case 1: enable_E1(); g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2; - if (g_uc_extruder_last_move[0] == 0) disable_E0(); + DISABLE_IDLE_E(0); #if EXTRUDERS > 2 - if (g_uc_extruder_last_move[2] == 0) disable_E2(); + DISABLE_IDLE_E(2); #if EXTRUDERS > 3 - if (g_uc_extruder_last_move[3] == 0) disable_E3(); + DISABLE_IDLE_E(3); #if EXTRUDERS > 4 - if (g_uc_extruder_last_move[4] == 0) disable_E4(); + DISABLE_IDLE_E(4); #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 @@ -908,12 +910,12 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const case 2: enable_E2(); g_uc_extruder_last_move[2] = (BLOCK_BUFFER_SIZE) * 2; - if (g_uc_extruder_last_move[0] == 0) disable_E0(); - if (g_uc_extruder_last_move[1] == 0) disable_E1(); + DISABLE_IDLE_E(0); + DISABLE_IDLE_E(1); #if EXTRUDERS > 3 - if (g_uc_extruder_last_move[3] == 0) disable_E3(); + DISABLE_IDLE_E(3); #if EXTRUDERS > 4 - if (g_uc_extruder_last_move[4] == 0) disable_E4(); + DISABLE_IDLE_E(4); #endif #endif break; @@ -921,21 +923,21 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const case 3: enable_E3(); g_uc_extruder_last_move[3] = (BLOCK_BUFFER_SIZE) * 2; - if (g_uc_extruder_last_move[0] == 0) disable_E0(); - if (g_uc_extruder_last_move[1] == 0) disable_E1(); - if (g_uc_extruder_last_move[2] == 0) disable_E2(); + DISABLE_IDLE_E(0); + DISABLE_IDLE_E(1); + DISABLE_IDLE_E(2); #if EXTRUDERS > 4 - if (g_uc_extruder_last_move[4] == 0) disable_E4(); + DISABLE_IDLE_E(4); #endif break; #if EXTRUDERS > 4 case 4: enable_E4(); g_uc_extruder_last_move[4] = (BLOCK_BUFFER_SIZE) * 2; - if (g_uc_extruder_last_move[0] == 0) disable_E0(); - if (g_uc_extruder_last_move[1] == 0) disable_E1(); - if (g_uc_extruder_last_move[2] == 0) disable_E2(); - if (g_uc_extruder_last_move[3] == 0) disable_E3(); + DISABLE_IDLE_E(0); + DISABLE_IDLE_E(1); + DISABLE_IDLE_E(2); + DISABLE_IDLE_E(3); break; #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3