Browse Source

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

BigTreeTech 3 years ago
parent
commit
37e671612e
No account linked to committer's email address
1 changed files with 15 additions and 5 deletions
  1. 15
    5
      Marlin/src/module/stepper.cpp

+ 15
- 5
Marlin/src/module/stepper.cpp View File

1697
       #if EITHER(LIN_ADVANCE, MIXING_EXTRUDER)
1697
       #if EITHER(LIN_ADVANCE, MIXING_EXTRUDER)
1698
         delta_error.e += advance_dividend.e;
1698
         delta_error.e += advance_dividend.e;
1699
         if (delta_error.e >= 0) {
1699
         if (delta_error.e >= 0) {
1700
-          count_position.e += count_direction.e;
1701
           #if ENABLED(LIN_ADVANCE)
1700
           #if ENABLED(LIN_ADVANCE)
1702
             delta_error.e -= advance_divisor;
1701
             delta_error.e -= advance_divisor;
1703
             // Don't step E here - But remember the number of steps to perform
1702
             // Don't step E here - But remember the number of steps to perform
1704
             motor_direction(E_AXIS) ? --LA_steps : ++LA_steps;
1703
             motor_direction(E_AXIS) ? --LA_steps : ++LA_steps;
1705
           #else
1704
           #else
1705
+            count_position.e += count_direction.e;
1706
             step_needed.e = true;
1706
             step_needed.e = true;
1707
           #endif
1707
           #endif
1708
         }
1708
         }
2283
     #if ENABLED(MIXING_EXTRUDER)
2283
     #if ENABLED(MIXING_EXTRUDER)
2284
       // We don't know which steppers will be stepped because LA loop follows,
2284
       // We don't know which steppers will be stepped because LA loop follows,
2285
       // with potentially multiple steps. Set all.
2285
       // with potentially multiple steps. Set all.
2286
-      if (LA_steps > 0)
2286
+      if (LA_steps > 0) {
2287
         MIXER_STEPPER_LOOP(j) NORM_E_DIR(j);
2287
         MIXER_STEPPER_LOOP(j) NORM_E_DIR(j);
2288
-      else if (LA_steps < 0)
2288
+        count_direction.e = 1;
2289
+      }
2290
+      else if (LA_steps < 0) {
2289
         MIXER_STEPPER_LOOP(j) REV_E_DIR(j);
2291
         MIXER_STEPPER_LOOP(j) REV_E_DIR(j);
2292
+        count_direction.e = -1;
2293
+      }
2290
     #else
2294
     #else
2291
-      if (LA_steps > 0)
2295
+      if (LA_steps > 0) {
2292
         NORM_E_DIR(stepper_extruder);
2296
         NORM_E_DIR(stepper_extruder);
2293
-      else if (LA_steps < 0)
2297
+        count_direction.e = 1;
2298
+      }
2299
+      else if (LA_steps < 0) {
2294
         REV_E_DIR(stepper_extruder);
2300
         REV_E_DIR(stepper_extruder);
2301
+        count_direction.e = -1;
2302
+      }
2295
     #endif
2303
     #endif
2296
 
2304
 
2297
     DIR_WAIT_AFTER();
2305
     DIR_WAIT_AFTER();
2312
           AWAIT_LOW_PULSE();
2320
           AWAIT_LOW_PULSE();
2313
       #endif
2321
       #endif
2314
 
2322
 
2323
+      count_position.e += count_direction.e;
2324
+
2315
       // Set the STEP pulse ON
2325
       // Set the STEP pulse ON
2316
       #if ENABLED(MIXING_EXTRUDER)
2326
       #if ENABLED(MIXING_EXTRUDER)
2317
         E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN);
2327
         E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN);

Loading…
Cancel
Save