Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix M114 E & R broken by LIN_ADVANCE #21579

Merged
merged 3 commits into from
Apr 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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