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:
@@ -96,8 +96,7 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
volatile int Stepper::e_steps[E_STEPPERS];
|
||||
int Stepper::extruder_advance_k = LIN_ADVANCE_K,
|
||||
Stepper::final_estep_rate,
|
||||
int Stepper::final_estep_rate,
|
||||
Stepper::current_estep_rate[E_STEPPERS],
|
||||
Stepper::current_adv_steps[E_STEPPERS];
|
||||
#else
|
||||
@@ -534,7 +533,7 @@ void Stepper::isr() {
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
if (current_block->use_advance_lead) {
|
||||
int delta_adv_steps = (((long)extruder_advance_k * current_estep_rate[TOOL_E_INDEX]) >> 9) - current_adv_steps[TOOL_E_INDEX];
|
||||
int delta_adv_steps = current_estep_rate[TOOL_E_INDEX] - current_adv_steps[TOOL_E_INDEX];
|
||||
current_adv_steps[TOOL_E_INDEX] += delta_adv_steps;
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
// Mixing extruders apply advance lead proportionally
|
||||
@@ -572,9 +571,9 @@ void Stepper::isr() {
|
||||
if (current_block->use_advance_lead) {
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
MIXING_STEPPERS_LOOP(j)
|
||||
current_estep_rate[j] = ((uint32_t)acc_step_rate * current_block->e_speed_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 8;
|
||||
current_estep_rate[j] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 17;
|
||||
#else
|
||||
current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->e_speed_multiplier8) >> 8;
|
||||
current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -624,9 +623,9 @@ void Stepper::isr() {
|
||||
if (current_block->use_advance_lead) {
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
MIXING_STEPPERS_LOOP(j)
|
||||
current_estep_rate[j] = ((uint32_t)step_rate * current_block->e_speed_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 8;
|
||||
current_estep_rate[j] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 17;
|
||||
#else
|
||||
current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->e_speed_multiplier8) >> 8;
|
||||
current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1350,14 +1349,3 @@ void Stepper::report_positions() {
|
||||
}
|
||||
|
||||
#endif // HAS_MICROSTEPS
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
|
||||
void Stepper::advance_M905(const float &k) {
|
||||
if (k >= 0) extruder_advance_k = k;
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOPAIR("Advance factor: ", extruder_advance_k);
|
||||
SERIAL_EOL;
|
||||
}
|
||||
|
||||
#endif // LIN_ADVANCE
|
||||
|
Reference in New Issue
Block a user