瀏覽代碼

Use E_AXIS_N where possible

Scott Lahteine 6 年之前
父節點
當前提交
ac5f2762b7
共有 1 個檔案被更改,包括 3 行新增8 行删除
  1. 3
    8
      Marlin/src/module/planner.cpp

+ 3
- 8
Marlin/src/module/planner.cpp 查看文件

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

Loading…
取消
儲存