Browse Source

Move flow_percentage to Planner

Scott Lahteine 8 years ago
parent
commit
bf7af95db3

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

166
 FORCE_INLINE float homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
166
 FORCE_INLINE float homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
167
 
167
 
168
 static float saved_feedrate_mm_s;
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
 // Initialized by settings.load()
171
 // Initialized by settings.load()
173
 bool volumetric_enabled;
172
 bool volumetric_enabled;

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

187
 #define MMS_SCALED(MM_S) ((MM_S)*feedrate_percentage*0.01)
187
 #define MMS_SCALED(MM_S) ((MM_S)*feedrate_percentage*0.01)
188
 
188
 
189
 extern bool volumetric_enabled;
189
 extern bool volumetric_enabled;
190
-extern int16_t flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
191
 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.
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
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
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
 FWRetract fwretract; // Single instance
33
 FWRetract fwretract; // Single instance
34
 
34
 
35
 #include "../module/motion.h"
35
 #include "../module/motion.h"
36
+#include "../module/planner.h"
36
 
37
 
37
 bool FWRetract::autoretract_enabled,                 // M209 S - Autoretract switch
38
 bool FWRetract::autoretract_enabled,                 // M209 S - Autoretract switch
38
      FWRetract::retracted[EXTRUDERS] = { false };    // Which extruders are currently retracted
39
      FWRetract::retracted[EXTRUDERS] = { false };    // Which extruders are currently retracted
108
   const bool has_zhop = retract_zlift > 0.01;     // Is there a hop set?
109
   const bool has_zhop = retract_zlift > 0.01;     // Is there a hop set?
109
 
110
 
110
   const float old_feedrate_mm_s = feedrate_mm_s;
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
   // Don't apply flow multiplication to retract/recover
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
   // The current position will be the destination for E and Z moves
117
   // The current position will be the destination for E and Z moves
117
   set_destination_to_current();
118
   set_destination_to_current();
155
   }
156
   }
156
 
157
 
157
   // Restore flow and feedrate
158
   // Restore flow and feedrate
158
-  flow_percentage[active_extruder] = old_flow;
159
+  planner.flow_percentage[active_extruder] = old_flow;
159
   feedrate_mm_s = old_feedrate_mm_s;
160
   feedrate_mm_s = old_feedrate_mm_s;
160
 
161
 
161
   // The active extruder is now retracted or recovered
162
   // The active extruder is now retracted or recovered

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

21
  */
21
  */
22
 
22
 
23
 #include "../gcode.h"
23
 #include "../gcode.h"
24
-#include "../../Marlin.h"
24
+#include "../../module/planner.h"
25
 
25
 
26
 /**
26
 /**
27
  * M221: Set extrusion percentage (M221 T0 S95)
27
  * M221: Set extrusion percentage (M221 T0 S95)
29
 void GcodeSuite::M221() {
29
 void GcodeSuite::M221() {
30
   if (get_target_extruder_from_command()) return;
30
   if (get_target_extruder_from_command()) return;
31
   if (parser.seenval('S'))
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
   //SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
45
   //SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
46
   //SERIAL_PROTOCOL(filament_width_meas);
46
   //SERIAL_PROTOCOL(filament_width_meas);
47
   //SERIAL_PROTOCOLPGM("Extrusion ratio(%):");
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
     // Flow [1-5]:
1224
     // Flow [1-5]:
1225
     //
1225
     //
1226
     #if EXTRUDERS == 1
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
     #else // EXTRUDERS > 1
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
       #if EXTRUDERS > 2
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
         #if EXTRUDERS > 3
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
           #if EXTRUDERS > 4
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
           #endif // EXTRUDERS > 4
1238
           #endif // EXTRUDERS > 4
1239
         #endif // EXTRUDERS > 3
1239
         #endif // EXTRUDERS > 3
1240
       #endif // EXTRUDERS > 2
1240
       #endif // EXTRUDERS > 2

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

92
   uint8_t Planner::last_extruder = 0;     // Respond to extruder change
92
   uint8_t Planner::last_extruder = 0;     // Respond to extruder change
93
 #endif
93
 #endif
94
 
94
 
95
+int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
96
+
95
 uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N],
97
 uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N],
96
          Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software
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
       static uint8_t last_extruder;             // Respond to extruder change
143
       static uint8_t last_extruder;             // Respond to extruder change
144
     #endif
144
     #endif
145
 
145
 
146
+    static int16_t flow_percentage[EXTRUDERS];  // Extrusion factor for each extruder
147
+
146
     static float max_feedrate_mm_s[XYZE_N],     // Max speeds in mm per second
148
     static float max_feedrate_mm_s[XYZE_N],     // Max speeds in mm per second
147
                  axis_steps_per_mm[XYZE_N],
149
                  axis_steps_per_mm[XYZE_N],
148
                  steps_to_mm[XYZE_N];
150
                  steps_to_mm[XYZE_N];

Loading…
Cancel
Save