Selaa lähdekoodia

Use E_AXIS_N where possible

Scott Lahteine 6 vuotta sitten
vanhempi
commit
ac5f2762b7
1 muutettua tiedostoa jossa 3 lisäystä ja 8 poistoa
  1. 3
    8
      Marlin/src/module/planner.cpp

+ 3
- 8
Marlin/src/module/planner.cpp Näytä tiedosto

@@ -141,9 +141,6 @@ float Planner::steps_to_mm[XYZE_N];           // (mm) Millimeters per step
141 141
 
142 142
 #if ENABLED(DISTINCT_E_FACTORS)
143 143
   uint8_t Planner::last_extruder = 0;     // Respond to extruder change
144
-  #define _EINDEX (E_AXIS + active_extruder)
145
-#else
146
-  #define _EINDEX E_AXIS
147 144
 #endif
148 145
 
149 146
 int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
@@ -2696,7 +2693,7 @@ void Planner::set_machine_position_mm(const float &a, const float &b, const floa
2696 2693
   position[A_AXIS] = LROUND(a * settings.axis_steps_per_mm[A_AXIS]);
2697 2694
   position[B_AXIS] = LROUND(b * settings.axis_steps_per_mm[B_AXIS]);
2698 2695
   position[C_AXIS] = LROUND(c * settings.axis_steps_per_mm[C_AXIS]);
2699
-  position[E_AXIS] = LROUND(e * settings.axis_steps_per_mm[_EINDEX]);
2696
+  position[E_AXIS] = LROUND(e * settings.axis_steps_per_mm[E_AXIS_N(active_extruder)]);
2700 2697
   #if HAS_POSITION_FLOAT
2701 2698
     position_float[A_AXIS] = a;
2702 2699
     position_float[B_AXIS] = b;
@@ -2738,11 +2735,9 @@ void Planner::set_position_mm(const float &rx, const float &ry, const float &rz,
2738 2735
  * Setters for planner position (also setting stepper position).
2739 2736
  */
2740 2737
 void Planner::set_e_position_mm(const float &e) {
2738
+  const uint8_t axis_index = E_AXIS_N(active_extruder);
2741 2739
   #if ENABLED(DISTINCT_E_FACTORS)
2742
-    const uint8_t axis_index = E_AXIS + active_extruder;
2743 2740
     last_extruder = active_extruder;
2744
-  #else
2745
-    const uint8_t axis_index = E_AXIS;
2746 2741
   #endif
2747 2742
   #if ENABLED(FWRETRACT)
2748 2743
     float e_new = e - fwretract.current_retract[active_extruder];
@@ -2765,7 +2760,7 @@ void Planner::set_e_position_mm(const float &e) {
2765 2760
 // Recalculate the steps/s^2 acceleration rates, based on the mm/s^2
2766 2761
 void Planner::reset_acceleration_rates() {
2767 2762
   #if ENABLED(DISTINCT_E_FACTORS)
2768
-    #define AXIS_CONDITION (i < E_AXIS || i == E_AXIS + active_extruder)
2763
+    #define AXIS_CONDITION (i < E_AXIS || i == E_AXIS_N(active_extruder))
2769 2764
   #else
2770 2765
     #define AXIS_CONDITION true
2771 2766
   #endif

Loading…
Peruuta
Tallenna