Fix M114 E / R broken by LIN_ADVANCE (#21579)

This commit is contained in:
BigTreeTech 2021-04-10 16:44:36 +08:00 committed by GitHub
parent 3b3a3fa845
commit 37e671612e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1697,12 +1697,12 @@ void Stepper::pulse_phase_isr() {
#if EITHER(LIN_ADVANCE, MIXING_EXTRUDER) #if EITHER(LIN_ADVANCE, MIXING_EXTRUDER)
delta_error.e += advance_dividend.e; delta_error.e += advance_dividend.e;
if (delta_error.e >= 0) { if (delta_error.e >= 0) {
count_position.e += count_direction.e;
#if ENABLED(LIN_ADVANCE) #if ENABLED(LIN_ADVANCE)
delta_error.e -= advance_divisor; delta_error.e -= advance_divisor;
// Don't step E here - But remember the number of steps to perform // Don't step E here - But remember the number of steps to perform
motor_direction(E_AXIS) ? --LA_steps : ++LA_steps; motor_direction(E_AXIS) ? --LA_steps : ++LA_steps;
#else #else
count_position.e += count_direction.e;
step_needed.e = true; step_needed.e = true;
#endif #endif
} }
@ -2283,15 +2283,23 @@ uint32_t Stepper::block_phase_isr() {
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
// We don't know which steppers will be stepped because LA loop follows, // We don't know which steppers will be stepped because LA loop follows,
// with potentially multiple steps. Set all. // with potentially multiple steps. Set all.
if (LA_steps > 0) if (LA_steps > 0) {
MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); MIXER_STEPPER_LOOP(j) NORM_E_DIR(j);
else if (LA_steps < 0) count_direction.e = 1;
}
else if (LA_steps < 0) {
MIXER_STEPPER_LOOP(j) REV_E_DIR(j); MIXER_STEPPER_LOOP(j) REV_E_DIR(j);
count_direction.e = -1;
}
#else #else
if (LA_steps > 0) if (LA_steps > 0) {
NORM_E_DIR(stepper_extruder); NORM_E_DIR(stepper_extruder);
else if (LA_steps < 0) count_direction.e = 1;
}
else if (LA_steps < 0) {
REV_E_DIR(stepper_extruder); REV_E_DIR(stepper_extruder);
count_direction.e = -1;
}
#endif #endif
DIR_WAIT_AFTER(); DIR_WAIT_AFTER();
@ -2312,6 +2320,8 @@ uint32_t Stepper::block_phase_isr() {
AWAIT_LOW_PULSE(); AWAIT_LOW_PULSE();
#endif #endif
count_position.e += count_direction.e;
// Set the STEP pulse ON // Set the STEP pulse ON
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN); E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN);