More 2nd extruder implementation. (Not usable)
Advance (not tested)
This commit is contained in:
parent
0bc9daa4f7
commit
6b86f15686
@ -223,11 +223,11 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
|||||||
|
|
||||||
#define DEFAULT_AXIS_STEPS_PER_UNIT {78.7402,78.7402,200*8/3,760*1.1} // default steps per unit for ultimaker
|
#define DEFAULT_AXIS_STEPS_PER_UNIT {78.7402,78.7402,200*8/3,760*1.1} // default steps per unit for ultimaker
|
||||||
//#define DEFAULT_AXIS_STEPS_PER_UNIT {40, 40, 3333.92, 67} //sells mendel with v9 extruder
|
//#define DEFAULT_AXIS_STEPS_PER_UNIT {40, 40, 3333.92, 67} //sells mendel with v9 extruder
|
||||||
#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 200000} // (mm/sec)
|
#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 45} // (mm/sec)
|
||||||
#define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
|
#define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
|
||||||
|
|
||||||
#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
|
#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
|
||||||
#define DEFAULT_RETRACT_ACCELERATION 7000 // X, Y, Z and E max acceleration in mm/s^2 for r retracts
|
#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for r retracts
|
||||||
|
|
||||||
#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate
|
#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate
|
||||||
#define DEFAULT_MINTRAVELFEEDRATE 0.0
|
#define DEFAULT_MINTRAVELFEEDRATE 0.0
|
||||||
|
@ -489,11 +489,20 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
|
|||||||
if (target[Z_AXIS] < position[Z_AXIS]) { block->direction_bits |= (1<<Z_AXIS); }
|
if (target[Z_AXIS] < position[Z_AXIS]) { block->direction_bits |= (1<<Z_AXIS); }
|
||||||
if (target[E_AXIS] < position[E_AXIS]) { block->direction_bits |= (1<<E_AXIS); }
|
if (target[E_AXIS] < position[E_AXIS]) { block->direction_bits |= (1<<E_AXIS); }
|
||||||
|
|
||||||
|
block->active_extruder = extruder;
|
||||||
|
|
||||||
//enable active axes
|
//enable active axes
|
||||||
if(block->steps_x != 0) enable_x();
|
if(block->steps_x != 0) enable_x();
|
||||||
if(block->steps_y != 0) enable_y();
|
if(block->steps_y != 0) enable_y();
|
||||||
if(block->steps_z != 0) enable_z();
|
if(block->steps_z != 0) enable_z();
|
||||||
|
if(extruder == 0) {
|
||||||
if(block->steps_e != 0) enable_e();
|
if(block->steps_e != 0) enable_e();
|
||||||
|
}
|
||||||
|
#if (EXTRUDERS > 1)
|
||||||
|
if(extruder == 1) {
|
||||||
|
if(block->steps_e != 0) enable_e1();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
float delta_mm[4];
|
float delta_mm[4];
|
||||||
delta_mm[X_AXIS] = (target[X_AXIS]-position[X_AXIS])/axis_steps_per_unit[X_AXIS];
|
delta_mm[X_AXIS] = (target[X_AXIS]-position[X_AXIS])/axis_steps_per_unit[X_AXIS];
|
||||||
@ -713,7 +722,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
|
|||||||
else {
|
else {
|
||||||
long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st);
|
long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st);
|
||||||
float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) *
|
float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) *
|
||||||
(block->speed_e * block->speed_e * EXTRUTION_AREA * EXTRUTION_AREA / 3600.0)*65536;
|
(current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUTION_AREA * EXTRUTION_AREA / 3600.0)*65536;
|
||||||
block->advance = advance;
|
block->advance = advance;
|
||||||
if(acc_dist == 0) {
|
if(acc_dist == 0) {
|
||||||
block->advance_rate = 0;
|
block->advance_rate = 0;
|
||||||
|
@ -37,11 +37,12 @@ typedef struct {
|
|||||||
long decelerate_after; // The index of the step event on which to start decelerating
|
long decelerate_after; // The index of the step event on which to start decelerating
|
||||||
long acceleration_rate; // The acceleration rate used for acceleration calculation
|
long acceleration_rate; // The acceleration rate used for acceleration calculation
|
||||||
unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
|
unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
|
||||||
|
unsigned char active_extruder; // Selects the active extruder
|
||||||
#ifdef ADVANCE
|
#ifdef ADVANCE
|
||||||
// long advance_rate;
|
long advance_rate;
|
||||||
// volatile long initial_advance;
|
volatile long initial_advance;
|
||||||
// volatile long final_advance;
|
volatile long final_advance;
|
||||||
// float advance;
|
float advance;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fields used by the motion planner to manage acceleration
|
// Fields used by the motion planner to manage acceleration
|
||||||
|
@ -383,8 +383,9 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
}
|
}
|
||||||
#endif //!ADVANCE
|
#endif //!ADVANCE
|
||||||
for(int8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves)
|
for(int8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves)
|
||||||
MSerial.checkRx();
|
MSerial.checkRx(); // Check for serial chars.
|
||||||
/*
|
|
||||||
|
#ifdef ADVANCE
|
||||||
counter_e += current_block->steps_e;
|
counter_e += current_block->steps_e;
|
||||||
if (counter_e > 0) {
|
if (counter_e > 0) {
|
||||||
counter_e -= current_block->step_event_count;
|
counter_e -= current_block->step_event_count;
|
||||||
@ -399,14 +400,10 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
CRITICAL_SECTION_END;
|
CRITICAL_SECTION_END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/*
|
|
||||||
// Do E steps + advance steps
|
// Do E steps + advance steps
|
||||||
CRITICAL_SECTION_START;
|
|
||||||
e_steps += ((advance >> 16) - old_advance);
|
e_steps += ((advance >> 16) - old_advance);
|
||||||
CRITICAL_SECTION_END;
|
|
||||||
old_advance = advance >> 16;
|
old_advance = advance >> 16;
|
||||||
*/
|
#endif //ADVANCE
|
||||||
|
|
||||||
counter_x += current_block->steps_x;
|
counter_x += current_block->steps_x;
|
||||||
if (counter_x > 0) {
|
if (counter_x > 0) {
|
||||||
@ -461,7 +458,9 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
OCR1A = timer;
|
OCR1A = timer;
|
||||||
acceleration_time += timer;
|
acceleration_time += timer;
|
||||||
#ifdef ADVANCE
|
#ifdef ADVANCE
|
||||||
|
for(int8_t i=0; i < step_loops; i++) {
|
||||||
advance += advance_rate;
|
advance += advance_rate;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (step_events_completed > current_block->decelerate_after) {
|
else if (step_events_completed > current_block->decelerate_after) {
|
||||||
@ -483,7 +482,9 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
OCR1A = timer;
|
OCR1A = timer;
|
||||||
deceleration_time += timer;
|
deceleration_time += timer;
|
||||||
#ifdef ADVANCE
|
#ifdef ADVANCE
|
||||||
|
for(int8_t i=0; i < step_loops; i++) {
|
||||||
advance -= advance_rate;
|
advance -= advance_rate;
|
||||||
|
}
|
||||||
if(advance < final_advance)
|
if(advance < final_advance)
|
||||||
advance = final_advance;
|
advance = final_advance;
|
||||||
#endif //ADVANCE
|
#endif //ADVANCE
|
||||||
@ -506,10 +507,13 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
// Timer 0 is shared with millies
|
// Timer 0 is shared with millies
|
||||||
ISR(TIMER0_COMPA_vect)
|
ISR(TIMER0_COMPA_vect)
|
||||||
{
|
{
|
||||||
// Critical section needed because Timer 1 interrupt has higher priority.
|
old_OCR0A += 25; // ~10kHz interrupt
|
||||||
// The pin set functions are placed on trategic position to comply with the stepper driver timing.
|
OCR0A = old_OCR0A;
|
||||||
WRITE(E_STEP_PIN, LOW);
|
|
||||||
// Set E direction (Depends on E direction + advance)
|
// Set E direction (Depends on E direction + advance)
|
||||||
|
for(unsigned char i=0; i<4;) {
|
||||||
|
WRITE(E_STEP_PIN, LOW);
|
||||||
|
if (e_steps == 0) break;
|
||||||
|
i++;
|
||||||
if (e_steps < 0) {
|
if (e_steps < 0) {
|
||||||
WRITE(E_DIR_PIN,INVERT_E_DIR);
|
WRITE(E_DIR_PIN,INVERT_E_DIR);
|
||||||
e_steps++;
|
e_steps++;
|
||||||
@ -520,8 +524,7 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
e_steps--;
|
e_steps--;
|
||||||
WRITE(E_STEP_PIN, HIGH);
|
WRITE(E_STEP_PIN, HIGH);
|
||||||
}
|
}
|
||||||
old_OCR0A += 25; // 10kHz interrupt
|
}
|
||||||
OCR0A = old_OCR0A;
|
|
||||||
}
|
}
|
||||||
#endif // ADVANCE
|
#endif // ADVANCE
|
||||||
|
|
||||||
@ -638,6 +641,10 @@ void st_init()
|
|||||||
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
||||||
|
|
||||||
#ifdef ADVANCE
|
#ifdef ADVANCE
|
||||||
|
#if defined(TCCR0A) && defined(WGM01)
|
||||||
|
TCCR0A &= ~(1<<WGM01);
|
||||||
|
TCCR0A &= ~(1<<WGM00);
|
||||||
|
#endif
|
||||||
e_steps = 0;
|
e_steps = 0;
|
||||||
TIMSK0 |= (1<<OCIE0A);
|
TIMSK0 |= (1<<OCIE0A);
|
||||||
#endif //ADVANCE
|
#endif //ADVANCE
|
||||||
|
Loading…
Reference in New Issue
Block a user