Browse Source

Move flow_percentage to Planner

Scott Lahteine 8 years ago
parent
commit
bf7af95db3

+ 1
- 2
Marlin/src/Marlin.cpp View File

@@ -166,8 +166,7 @@ static const float homing_feedrate_mm_s[] PROGMEM = {
166 166
 FORCE_INLINE float homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
167 167
 
168 168
 static float saved_feedrate_mm_s;
169
-int16_t feedrate_percentage = 100, saved_feedrate_percentage,
170
-    flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100);
169
+int16_t feedrate_percentage = 100, saved_feedrate_percentage;
171 170
 
172 171
 // Initialized by settings.load()
173 172
 bool volumetric_enabled;

+ 0
- 1
Marlin/src/Marlin.h View File

@@ -187,7 +187,6 @@ extern int16_t feedrate_percentage;
187 187
 #define MMS_SCALED(MM_S) ((MM_S)*feedrate_percentage*0.01)
188 188
 
189 189
 extern bool volumetric_enabled;
190
-extern int16_t flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
191 190
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
192 191
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
193 192
 

+ 4
- 3
Marlin/src/feature/fwretract.cpp View File

@@ -33,6 +33,7 @@
33 33
 FWRetract fwretract; // Single instance
34 34
 
35 35
 #include "../module/motion.h"
36
+#include "../module/planner.h"
36 37
 
37 38
 bool FWRetract::autoretract_enabled,                 // M209 S - Autoretract switch
38 39
      FWRetract::retracted[EXTRUDERS] = { false };    // Which extruders are currently retracted
@@ -108,10 +109,10 @@ void FWRetract::retract(const bool retracting
108 109
   const bool has_zhop = retract_zlift > 0.01;     // Is there a hop set?
109 110
 
110 111
   const float old_feedrate_mm_s = feedrate_mm_s;
111
-  const int16_t old_flow = flow_percentage[active_extruder];
112
+  const int16_t old_flow = planner.flow_percentage[active_extruder];
112 113
 
113 114
   // Don't apply flow multiplication to retract/recover
114
-  flow_percentage[active_extruder] = 100;
115
+  planner.flow_percentage[active_extruder] = 100;
115 116
 
116 117
   // The current position will be the destination for E and Z moves
117 118
   set_destination_to_current();
@@ -155,7 +156,7 @@ void FWRetract::retract(const bool retracting
155 156
   }
156 157
 
157 158
   // Restore flow and feedrate
158
-  flow_percentage[active_extruder] = old_flow;
159
+  planner.flow_percentage[active_extruder] = old_flow;
159 160
   feedrate_mm_s = old_feedrate_mm_s;
160 161
 
161 162
   // The active extruder is now retracted or recovered

+ 2
- 2
Marlin/src/gcode/config/M221.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 
23 23
 #include "../gcode.h"
24
-#include "../../Marlin.h"
24
+#include "../../module/planner.h"
25 25
 
26 26
 /**
27 27
  * M221: Set extrusion percentage (M221 T0 S95)
@@ -29,5 +29,5 @@
29 29
 void GcodeSuite::M221() {
30 30
   if (get_target_extruder_from_command()) return;
31 31
   if (parser.seenval('S'))
32
-    flow_percentage[target_extruder] = parser.value_int();
32
+    planner.flow_percentage[target_extruder] = parser.value_int();
33 33
 }

+ 1
- 1
Marlin/src/gcode/sensor/M405.h View File

@@ -45,5 +45,5 @@ void gcode_M405() {
45 45
   //SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
46 46
   //SERIAL_PROTOCOL(filament_width_meas);
47 47
   //SERIAL_PROTOCOLPGM("Extrusion ratio(%):");
48
-  //SERIAL_PROTOCOL(flow_percentage[active_extruder]);
48
+  //SERIAL_PROTOCOL(planner.flow_percentage[active_extruder]);
49 49
 }

+ 7
- 7
Marlin/src/lcd/ultralcd.cpp View File

@@ -1224,17 +1224,17 @@ void kill_screen(const char* lcd_msg) {
1224 1224
     // Flow [1-5]:
1225 1225
     //
1226 1226
     #if EXTRUDERS == 1
1227
-      MENU_ITEM_EDIT(int3, MSG_FLOW, &flow_percentage[0], 10, 999);
1227
+      MENU_ITEM_EDIT(int3, MSG_FLOW, &planner.flow_percentage[0], 10, 999);
1228 1228
     #else // EXTRUDERS > 1
1229
-      MENU_ITEM_EDIT(int3, MSG_FLOW, &flow_percentage[active_extruder], 10, 999);
1230
-      MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N1, &flow_percentage[0], 10, 999);
1231
-      MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N2, &flow_percentage[1], 10, 999);
1229
+      MENU_ITEM_EDIT(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999);
1230
+      MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N1, &planner.flow_percentage[0], 10, 999);
1231
+      MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N2, &planner.flow_percentage[1], 10, 999);
1232 1232
       #if EXTRUDERS > 2
1233
-        MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &flow_percentage[2], 10, 999);
1233
+        MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &planner.flow_percentage[2], 10, 999);
1234 1234
         #if EXTRUDERS > 3
1235
-          MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N4, &flow_percentage[3], 10, 999);
1235
+          MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N4, &planner.flow_percentage[3], 10, 999);
1236 1236
           #if EXTRUDERS > 4
1237
-            MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N5, &flow_percentage[4], 10, 999);
1237
+            MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N5, &planner.flow_percentage[4], 10, 999);
1238 1238
           #endif // EXTRUDERS > 4
1239 1239
         #endif // EXTRUDERS > 3
1240 1240
       #endif // EXTRUDERS > 2

+ 2
- 0
Marlin/src/module/planner.cpp View File

@@ -92,6 +92,8 @@ float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
92 92
   uint8_t Planner::last_extruder = 0;     // Respond to extruder change
93 93
 #endif
94 94
 
95
+int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
96
+
95 97
 uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N],
96 98
          Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software
97 99
 

+ 2
- 0
Marlin/src/module/planner.h View File

@@ -143,6 +143,8 @@ class Planner {
143 143
       static uint8_t last_extruder;             // Respond to extruder change
144 144
     #endif
145 145
 
146
+    static int16_t flow_percentage[EXTRUDERS];  // Extrusion factor for each extruder
147
+
146 148
     static float max_feedrate_mm_s[XYZE_N],     // Max speeds in mm per second
147 149
                  axis_steps_per_mm[XYZE_N],
148 150
                  steps_to_mm[XYZE_N];

Loading…
Cancel
Save