Browse Source

Add Planner::set_filament_size for 2.0.x parity

Scott Lahteine 7 years ago
parent
commit
8f462b5717
2 changed files with 12 additions and 8 deletions
  1. 2
    6
      Marlin/Marlin_main.cpp
  2. 10
    2
      Marlin/planner.h

+ 2
- 6
Marlin/Marlin_main.cpp View File

@@ -8714,12 +8714,8 @@ inline void gcode_M200() {
8714 8714
     // setting any extruder filament size disables volumetric on the assumption that
8715 8715
     // slicers either generate in extruder values as cubic mm or as as filament feeds
8716 8716
     // for all extruders
8717
-    if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) ) {
8718
-      planner.filament_size[target_extruder] = parser.value_linear_units();
8719
-      // make sure all extruders have some sane value for the filament size
8720
-      for (uint8_t i = 0; i < COUNT(planner.filament_size); i++)
8721
-        if (!planner.filament_size[i]) planner.filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
8722
-    }
8717
+    if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) )
8718
+      planner.set_filament_size(target_extruder, parser.value_linear_units());
8723 8719
   }
8724 8720
   planner.calculate_volumetric_multipliers();
8725 8721
 }

+ 10
- 2
Marlin/planner.h View File

@@ -251,8 +251,6 @@ class Planner {
251 251
     // Manage fans, paste pressure, etc.
252 252
     static void check_axes_activity();
253 253
 
254
-    static void calculate_volumetric_multipliers();
255
-
256 254
     /**
257 255
      * Number of moves currently in the planner
258 256
      */
@@ -260,6 +258,16 @@ class Planner {
260 258
 
261 259
     static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
262 260
 
261
+    // Update multipliers based on new diameter measurements
262
+    static void calculate_volumetric_multipliers();
263
+
264
+    FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) {
265
+      filament_size[e] = v;
266
+      // make sure all extruders have some sane value for the filament size
267
+      for (uint8_t i = 0; i < COUNT(filament_size); i++)
268
+        if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
269
+    }
270
+
263 271
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
264 272
 
265 273
       /**

Loading…
Cancel
Save