BugFix for incorrect E-speed calculation

The extrusion speed was wrong due to a not high enough precision of
esteps to XY steps, therefore now the target float values are used to
calculate the ratio between XY movement and extrusion speed.
The e_speed_multiplier8 was replaced by an absolute multiplier called
abs_adv_steps_multiplier8, therefore one multiplication and bitshift can
be saved inside the stepper ISR. Due to this, also extruder_advance_k is
better suited inside the planner and not the stepper files any more.
This commit is contained in:
Sebastianv650
2016-10-31 16:17:30 +01:00
parent fa6bf12697
commit f9bea7968f
5 changed files with 48 additions and 30 deletions

View File

@ -109,7 +109,6 @@ class Stepper {
static volatile unsigned char eISR_Rate;
#if ENABLED(LIN_ADVANCE)
static volatile int e_steps[E_STEPPERS];
static int extruder_advance_k;
static int final_estep_rate;
static int current_estep_rate[E_STEPPERS]; // Actual extruder speed [steps/s]
static int current_adv_steps[E_STEPPERS]; // The amount of current added esteps due to advance.
@ -277,11 +276,6 @@ class Stepper {
return endstops_trigsteps[axis] * planner.steps_to_mm[axis];
}
#if ENABLED(LIN_ADVANCE)
void advance_M905(const float &k);
FORCE_INLINE int get_advance_k() { return extruder_advance_k; }
#endif
private:
static FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
@ -367,8 +361,8 @@ class Stepper {
#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;
current_estep_rate[current_block->active_extruder] = ((unsigned long)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
final_estep_rate = (current_block->nominal_rate * current_block->abs_adv_steps_multiplier8) >> 17;
}
#endif