Add 4th extruder

This commit is contained in:
MagoKimbra
2015-01-23 23:13:06 +01:00
parent 9552e59306
commit 986e723eeb
16 changed files with 614 additions and 219 deletions

View File

@ -55,7 +55,7 @@ volatile static unsigned long step_events_completed; // The number of step event
#ifdef ADVANCE
static long advance_rate, advance, final_advance = 0;
static long old_advance = 0;
static long e_steps[3];
static long e_steps[4];
#endif
static long acceleration_time, deceleration_time;
//static unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
@ -200,6 +200,8 @@ void checkHitEndstops()
setTargetHotend0(0);
setTargetHotend1(0);
setTargetHotend2(0);
setTargetHotend3(0);
setTargetBed(0);
}
#endif
}
@ -298,7 +300,7 @@ FORCE_INLINE void trapezoid_generator_reset() {
// SERIAL_ECHOPGM("advance rate :");
// SERIAL_ECHO(current_block->advance_rate/256.0);
// SERIAL_ECHOPGM("initial advance :");
// SERIAL_ECHO(current_block->initial_advance/256.0);
// SERIAL_ECHO(current_block->initial_advance/256.0);
// SERIAL_ECHOPGM("final advance :");
// SERIAL_ECHOLN(current_block->final_advance/256.0);
@ -552,8 +554,8 @@ ISR(TIMER1_COMPA_vect)
}
#endif //ADVANCE
counter_x += current_block->steps_x;
#ifdef CONFIG_STEPPERS_TOSHIBA
counter_x += current_block->steps_x;
#ifdef CONFIG_STEPPERS_TOSHIBA
/* The toshiba stepper controller require much longer pulses
* tjerfore we 'stage' decompose the pulses between high, and
* low instead of doing each in turn. The extra tests add enough
@ -681,7 +683,7 @@ ISR(TIMER1_COMPA_vect)
WRITE_E_STEP(INVERT_E_STEP_PIN);
}
#endif //!ADVANCE
#endif
#endif // CONFIG_STEPPERS_TOSHIBA
step_events_completed += 1;
if(step_events_completed >= current_block->step_event_count) break;
}
@ -807,6 +809,22 @@ ISR(TIMER1_COMPA_vect)
}
}
#endif
#if EXTRUDERS > 3
if (e_steps[3] != 0) {
WRITE(E3_STEP_PIN, INVERT_E_STEP_PIN);
if (e_steps[3] < 0) {
WRITE(E3_DIR_PIN, INVERT_E3_DIR);
e_steps[3]++;
WRITE(E3_STEP_PIN, !INVERT_E_STEP_PIN);
}
else if (e_steps[3] > 0) {
WRITE(E3_DIR_PIN, !INVERT_E3_DIR);
e_steps[3]--;
WRITE(E3_STEP_PIN, !INVERT_E_STEP_PIN);
}
}
#endif
}
}
#endif // ADVANCE
@ -846,6 +864,9 @@ void st_init()
#if defined(E2_DIR_PIN) && (E2_DIR_PIN > -1)
SET_OUTPUT(E2_DIR_PIN);
#endif
#if defined(E3_DIR_PIN) && (E3_DIR_PIN > -1)
SET_OUTPUT(E3_DIR_PIN);
#endif
//Initialize Enable Pins - steppers default to disabled.
@ -887,6 +908,10 @@ void st_init()
SET_OUTPUT(E2_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E2_ENABLE_PIN,HIGH);
#endif
#if defined(E3_ENABLE_PIN) && (E3_ENABLE_PIN > -1)
SET_OUTPUT(E3_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E3_ENABLE_PIN,HIGH);
#endif
//endstops and pullups
@ -977,6 +1002,11 @@ void st_init()
WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN);
disable_e2();
#endif
#if defined(E3_STEP_PIN) && (E3_STEP_PIN > -1)
SET_OUTPUT(E3_STEP_PIN);
WRITE(E3_STEP_PIN,INVERT_E_STEP_PIN);
disable_e3();
#endif
// waveform generation = 0100 = CTC
TCCR1B &= ~(1<<WGM13);
@ -1007,6 +1037,7 @@ void st_init()
e_steps[0] = 0;
e_steps[1] = 0;
e_steps[2] = 0;
e_steps[3] = 0;
TIMSK0 |= (1<<OCIE0A);
#endif //ADVANCE
@ -1068,6 +1099,7 @@ void finishAndDisableSteppers()
disable_e0();
disable_e1();
disable_e2();
disable_e3();
}
void quickStop()