Skip to content

Commit

Permalink
Fixes for DUAL_NOZZLE_DUPLICATION_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 1, 2017
1 parent 8bd63aa commit 8002672
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Marlin/enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
46 changes: 24 additions & 22 deletions Marlin/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -908,34 +910,34 @@ 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;
#if EXTRUDERS > 3
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
Expand Down

0 comments on commit 8002672

Please sign in to comment.