Add LIN_ADVANCE
This commit is contained in:
committed by
Scott Lahteine
parent
e2d4919c01
commit
fb8e880734
@ -93,6 +93,10 @@ class Stepper {
|
||||
#if ENABLED(ADVANCE)
|
||||
static long e_steps[EXTRUDERS];
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
int extruder_advance_k = LIN_K;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
@ -111,6 +115,14 @@ class Stepper {
|
||||
static unsigned char old_OCR0A;
|
||||
static long advance_rate, advance, old_advance, final_advance;
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
unsigned char old_OCR0A;
|
||||
volatile int e_steps[EXTRUDERS];
|
||||
int final_estep_rate;
|
||||
int current_estep_rate[EXTRUDERS]; //Actual extruder speed [steps/s]
|
||||
int current_adv_steps[EXTRUDERS]; //The amount of current added esteps due to advance. Think of it as the current amount of pressure applied to the spring (=filament).
|
||||
#endif
|
||||
|
||||
static long acceleration_time, deceleration_time;
|
||||
//unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
|
||||
@ -159,6 +171,12 @@ class Stepper {
|
||||
#if ENABLED(ADVANCE)
|
||||
static void advance_isr();
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
void advance_isr();
|
||||
void advance_M905();
|
||||
int get_advance_k();
|
||||
#endif
|
||||
|
||||
//
|
||||
// Block until all buffered steps are executed
|
||||
@ -315,6 +333,13 @@ class Stepper {
|
||||
acc_step_rate = current_block->initial_rate;
|
||||
acceleration_time = calc_timer(acc_step_rate);
|
||||
OCR1A = acceleration_time;
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
if (current_block->use_advance_lead){
|
||||
current_estep_rate[current_block->active_extruder] = ((unsigned long)acc_step_rate * current_block->e_speed_multiplier8) >> 8;
|
||||
final_estep_rate = (current_block->nominal_rate * current_block->e_speed_multiplier8) >> 8;
|
||||
}
|
||||
#endif
|
||||
|
||||
// SERIAL_ECHO_START;
|
||||
// SERIAL_ECHOPGM("advance :");
|
||||
@ -332,4 +357,4 @@ class Stepper {
|
||||
|
||||
};
|
||||
|
||||
#endif // STEPPER_H
|
||||
#endif // STEPPER_H
|
||||
|
Reference in New Issue
Block a user