Skip to content

Commit

Permalink
Fix M114 E / R broken by LIN_ADVANCE (#21579)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtreetech authored and thinkyhead committed Apr 29, 2021
1 parent 34f7142 commit 9a31702
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1697,12 +1697,12 @@ void Stepper::pulse_phase_isr() {
#if EITHER(LIN_ADVANCE, MIXING_EXTRUDER)
delta_error.e += advance_dividend.e;
if (delta_error.e >= 0) {
count_position.e += count_direction.e;
#if ENABLED(LIN_ADVANCE)
delta_error.e -= advance_divisor;
// Don't step E here - But remember the number of steps to perform
motor_direction(E_AXIS) ? --LA_steps : ++LA_steps;
#else
count_position.e += count_direction.e;
step_needed.e = true;
#endif
}
Expand Down Expand Up @@ -2283,15 +2283,23 @@ uint32_t Stepper::block_phase_isr() {
#if ENABLED(MIXING_EXTRUDER)
// We don't know which steppers will be stepped because LA loop follows,
// with potentially multiple steps. Set all.
if (LA_steps > 0)
if (LA_steps > 0) {
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);
count_direction.e = -1;
}
#else
if (LA_steps > 0)
if (LA_steps > 0) {
NORM_E_DIR(stepper_extruder);
else if (LA_steps < 0)
count_direction.e = 1;
}
else if (LA_steps < 0) {
REV_E_DIR(stepper_extruder);
count_direction.e = -1;
}
#endif

DIR_WAIT_AFTER();
Expand All @@ -2312,6 +2320,8 @@ uint32_t Stepper::block_phase_isr() {
AWAIT_LOW_PULSE();
#endif

count_position.e += count_direction.e;

// Set the STEP pulse ON
#if ENABLED(MIXING_EXTRUDER)
E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN);
Expand Down

0 comments on commit 9a31702

Please sign in to comment.