Change order of inactive stepper disable/enable

This ensures that steppers that share an enable pin will only be disabled for a miniscule time.
This commit is contained in:
Scott Lahteine 2018-03-30 15:07:11 -05:00
parent 55e9b85ad6
commit ac7e97f4fe

View file

@ -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