Quellcode durchsuchen

Add volumetric extrusion limit (#17017)

MoellerDi vor 4 Jahren
Ursprung
Commit
bac760207c
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 13
- 1
Marlin/Configuration_adv.h Datei anzeigen

2993
    * Activate to make volumetric extrusion the default method,
2993
    * Activate to make volumetric extrusion the default method,
2994
    * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
2994
    * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
2995
    *
2995
    *
2996
-   * M200 D0 to disable, M200 Dn to set a new diameter.
2996
+   * M200 D0 to disable, M200 Dn to set a new diameter (and enable volumetric).
2997
+   * M200 S0/S1 to disable/enable volumetric extrusion.
2997
    */
2998
    */
2998
   //#define VOLUMETRIC_DEFAULT_ON
2999
   //#define VOLUMETRIC_DEFAULT_ON
3000
+
3001
+  //#define VOLUMETRIC_EXTRUDER_LIMIT
3002
+  #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
3003
+    /**
3004
+     * Default volumetric extrusion limit in cubic mm per second (mm^3/sec).
3005
+     * This factory setting applies to all extruders.
3006
+     * Use 'M200 [T<extruder>] L<limit>' to override and 'M502' to reset.
3007
+     * A non-zero value activates Volume-based Extrusion Limiting.
3008
+     */
3009
+    #define DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT 0.00      // (mm^3/sec)
3010
+  #endif
2999
 #endif
3011
 #endif
3000
 
3012
 
3001
 /**
3013
 /**

+ 27
- 6
Marlin/src/gcode/config/M200-M205.cpp Datei anzeigen

30
    * M200: Set filament diameter and set E axis units to cubic units
30
    * M200: Set filament diameter and set E axis units to cubic units
31
    *
31
    *
32
    *    T<extruder> - Optional extruder number. Current extruder if omitted.
32
    *    T<extruder> - Optional extruder number. Current extruder if omitted.
33
-   *    D<linear> - Diameter of the filament. Use "D0" to switch back to linear units on the E axis.
33
+   *    D<linear>   - Set filament diameter and enable. D0 disables volumetric.
34
+   *    S<bool>     - Turn volumetric ON or OFF.
35
+   *    L<float>    - Volumetric extruder limit (in mm^3/sec). L0 disables the limit.
34
    */
36
    */
35
   void GcodeSuite::M200() {
37
   void GcodeSuite::M200() {
36
 
38
 
37
     const int8_t target_extruder = get_target_extruder_from_command();
39
     const int8_t target_extruder = get_target_extruder_from_command();
38
     if (target_extruder < 0) return;
40
     if (target_extruder < 0) return;
39
 
41
 
40
-    if (parser.seen('D')) {
41
-      // setting any extruder filament size disables volumetric on the assumption that
42
-      // slicers either generate in extruder values as cubic mm or as as filament feeds
43
-      // for all extruders
42
+    bool vol_enable = parser.volumetric_enabled,
43
+         can_enable = true;
44
+
45
+    if (parser.seenval('D')) {
44
       const float dval = parser.value_linear_units();
46
       const float dval = parser.value_linear_units();
45
-      if ( (parser.volumetric_enabled = (dval != 0)) )
47
+      if (dval) { // Set filament size for volumetric calculation
46
         planner.set_filament_size(target_extruder, dval);
48
         planner.set_filament_size(target_extruder, dval);
49
+        vol_enable = true;    // Dn = enable for compatibility
50
+      }
51
+      else
52
+        can_enable = false;   // D0 = disable for compatibility
47
     }
53
     }
54
+
55
+    // Enable or disable with S1 / S0
56
+    parser.volumetric_enabled = can_enable && parser.boolval('S', vol_enable);
57
+
58
+    #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
59
+      if (parser.seenval('L')) {
60
+        // Set volumetric limit (in mm^3/sec)
61
+        const float lval = parser.value_float();
62
+        if (WITHIN(lval, 0, 20))
63
+          planner.set_volumetric_extruder_limit(target_extruder, lval);
64
+        else
65
+          SERIAL_ECHOLNPGM("?L value out of range (0-20).");
66
+      }
67
+    #endif
68
+    
48
     planner.calculate_volumetric_multipliers();
69
     planner.calculate_volumetric_multipliers();
49
   }
70
   }
50
 
71
 

+ 7
- 0
Marlin/src/inc/Conditionals_post.h Datei anzeigen

261
 #endif
261
 #endif
262
 
262
 
263
 /**
263
 /**
264
+ * Provide a DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT in case NO_VOLUMETRICS is enabled
265
+ */
266
+#ifndef DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT
267
+  #define DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT 0.00
268
+#endif
269
+
270
+/**
264
  * LCD Contrast for Graphical Displays
271
  * LCD Contrast for Graphical Displays
265
  */
272
  */
266
 #if ENABLED(CARTESIO_UI)
273
 #if ENABLED(CARTESIO_UI)

+ 11
- 0
Marlin/src/inc/SanityCheck.h Datei anzeigen

1480
 #endif
1480
 #endif
1481
 
1481
 
1482
 /**
1482
 /**
1483
+ * Volumetric Extruder Limit
1484
+ */
1485
+#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
1486
+  #if ENABLED(NO_VOLUMETRICS)
1487
+    #error "VOLUMETRIC_EXTRUDER_LIMIT requires NO_VOLUMETRICS to be disabled."
1488
+  #elif MIN_STEPS_PER_SEGMENT > 1
1489
+    #error "VOLUMETRIC_EXTRUDER_LIMIT is not compatible with MIN_STEPS_PER_SEGMENT greater than 1."
1490
+  #endif
1491
+#endif
1492
+
1493
+/**
1483
  * ULTIPANEL encoder
1494
  * ULTIPANEL encoder
1484
  */
1495
  */
1485
 #if ENABLED(ULTIPANEL) && NONE(NEWPANEL, SR_LCD_2W_NL) && !defined(SHIFT_CLK)
1496
 #if ENABLED(ULTIPANEL) && NONE(NEWPANEL, SR_LCD_2W_NL) && !defined(SHIFT_CLK)

+ 2
- 0
Marlin/src/lcd/language/language_en.h Datei anzeigen

317
   PROGMEM Language_Str MSG_MOTION                          = _UxGT("Motion");
317
   PROGMEM Language_Str MSG_MOTION                          = _UxGT("Motion");
318
   PROGMEM Language_Str MSG_FILAMENT                        = _UxGT("Filament");
318
   PROGMEM Language_Str MSG_FILAMENT                        = _UxGT("Filament");
319
   PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED              = _UxGT("E in mm³");
319
   PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED              = _UxGT("E in mm³");
320
+  PROGMEM Language_Str MSG_VOLUMETRIC_LIMIT                = _UxGT("E Limit in mm³");
321
+  PROGMEM Language_Str MSG_VOLUMETRIC_LIMIT_E              = _UxGT("E Limit *");
320
   PROGMEM Language_Str MSG_FILAMENT_DIAM                   = _UxGT("Fil. Dia.");
322
   PROGMEM Language_Str MSG_FILAMENT_DIAM                   = _UxGT("Fil. Dia.");
321
   PROGMEM Language_Str MSG_FILAMENT_DIAM_E                 = _UxGT("Fil. Dia. *");
323
   PROGMEM Language_Str MSG_FILAMENT_DIAM_E                 = _UxGT("Fil. Dia. *");
322
   PROGMEM Language_Str MSG_FILAMENT_UNLOAD                 = _UxGT("Unload mm");
324
   PROGMEM Language_Str MSG_FILAMENT_UNLOAD                 = _UxGT("Unload mm");

+ 8
- 0
Marlin/src/lcd/menu/menu_advanced.cpp Datei anzeigen

117
     #if DISABLED(NO_VOLUMETRICS)
117
     #if DISABLED(NO_VOLUMETRICS)
118
       EDIT_ITEM(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers);
118
       EDIT_ITEM(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers);
119
 
119
 
120
+      #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
121
+        EDIT_ITEM_FAST(float42_52, MSG_VOLUMETRIC_LIMIT, &planner.volumetric_extruder_limit[active_extruder], 0.0f, 20.0f, planner.calculate_volumetric_extruder_limits);
122
+        #if EXTRUDERS > 1
123
+          LOOP_L_N(n, EXTRUDERS)
124
+            EDIT_ITEM_FAST_N(float42_52, n, MSG_VOLUMETRIC_LIMIT_E, &planner.volumetric_extruder_limit[n], 0.0f, 20.00f, planner.calculate_volumetric_extruder_limits);
125
+        #endif
126
+      #endif
127
+
120
       if (parser.volumetric_enabled) {
128
       if (parser.volumetric_enabled) {
121
         EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM, &planner.filament_size[active_extruder], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
129
         EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM, &planner.filament_size[active_extruder], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
122
         #if EXTRUDERS > 1
130
         #if EXTRUDERS > 1

+ 39
- 14
Marlin/src/module/configuration_store.cpp Datei anzeigen

37
  */
37
  */
38
 
38
 
39
 // Change EEPROM version if the structure changes
39
 // Change EEPROM version if the structure changes
40
-#define EEPROM_VERSION "V79"
40
+#define EEPROM_VERSION "V80"
41
 #define EEPROM_OFFSET 100
41
 #define EEPROM_OFFSET 100
42
 
42
 
43
 // Check the integrity of data offsets.
43
 // Check the integrity of data offsets.
320
   //
320
   //
321
   // !NO_VOLUMETRIC
321
   // !NO_VOLUMETRIC
322
   //
322
   //
323
-  bool parser_volumetric_enabled;                       // M200 D  parser.volumetric_enabled
323
+  bool parser_volumetric_enabled;                       // M200 S  parser.volumetric_enabled
324
   float planner_filament_size[EXTRUDERS];               // M200 T D  planner.filament_size[]
324
   float planner_filament_size[EXTRUDERS];               // M200 T D  planner.filament_size[]
325
+  float planner_volumetric_extruder_limit[EXTRUDERS];   // M200 T L  planner.volumetric_extruder_limit[]
325
 
326
 
326
   //
327
   //
327
   // HAS_TRINAMIC_CONFIG
328
   // HAS_TRINAMIC_CONFIG
935
 
936
 
936
         EEPROM_WRITE(parser.volumetric_enabled);
937
         EEPROM_WRITE(parser.volumetric_enabled);
937
         EEPROM_WRITE(planner.filament_size);
938
         EEPROM_WRITE(planner.filament_size);
939
+        #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
940
+          EEPROM_WRITE(planner.volumetric_extruder_limit);
941
+        #else
942
+          dummyf = DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT;
943
+          for (uint8_t q = EXTRUDERS; q--;) EEPROM_WRITE(dummyf);
944
+        #endif
938
 
945
 
939
       #else
946
       #else
940
 
947
 
941
         const bool volumetric_enabled = false;
948
         const bool volumetric_enabled = false;
942
-        dummyf = DEFAULT_NOMINAL_FILAMENT_DIA;
943
         EEPROM_WRITE(volumetric_enabled);
949
         EEPROM_WRITE(volumetric_enabled);
950
+        dummyf = DEFAULT_NOMINAL_FILAMENT_DIA;
951
+        for (uint8_t q = EXTRUDERS; q--;) EEPROM_WRITE(dummyf);
952
+        dummyf = DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT;
944
         for (uint8_t q = EXTRUDERS; q--;) EEPROM_WRITE(dummyf);
953
         for (uint8_t q = EXTRUDERS; q--;) EEPROM_WRITE(dummyf);
945
 
954
 
946
       #endif
955
       #endif
1787
         struct {
1796
         struct {
1788
           bool volumetric_enabled;
1797
           bool volumetric_enabled;
1789
           float filament_size[EXTRUDERS];
1798
           float filament_size[EXTRUDERS];
1799
+          #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
1800
+            float volumetric_extruder_limit[EXTRUDERS];
1801
+          #endif
1790
         } storage;
1802
         } storage;
1791
 
1803
 
1792
         _FIELD_TEST(parser_volumetric_enabled);
1804
         _FIELD_TEST(parser_volumetric_enabled);
1796
           if (!validating) {
1808
           if (!validating) {
1797
             parser.volumetric_enabled = storage.volumetric_enabled;
1809
             parser.volumetric_enabled = storage.volumetric_enabled;
1798
             COPY(planner.filament_size, storage.filament_size);
1810
             COPY(planner.filament_size, storage.filament_size);
1811
+            #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
1812
+              COPY(planner.volumetric_extruder_limit, storage.volumetric_extruder_limit);
1813
+            #endif
1799
           }
1814
           }
1800
         #endif
1815
         #endif
1801
       }
1816
       }
2598
     parser.volumetric_enabled = ENABLED(VOLUMETRIC_DEFAULT_ON);
2613
     parser.volumetric_enabled = ENABLED(VOLUMETRIC_DEFAULT_ON);
2599
     LOOP_L_N(q, COUNT(planner.filament_size))
2614
     LOOP_L_N(q, COUNT(planner.filament_size))
2600
       planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
2615
       planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
2616
+    #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
2617
+      LOOP_L_N(q, COUNT(planner.volumetric_extruder_limit))
2618
+        planner.volumetric_extruder_limit[q] = DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT;
2619
+    #endif
2601
   #endif
2620
   #endif
2602
 
2621
 
2603
   endstops.enable_globally(ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT));
2622
   endstops.enable_globally(ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT));
2750
 
2769
 
2751
     SERIAL_EOL();
2770
     SERIAL_EOL();
2752
 
2771
 
2753
-    #if DISABLED(NO_VOLUMETRICS)
2772
+    #if EXTRUDERS && DISABLED(NO_VOLUMETRICS)
2754
 
2773
 
2755
       /**
2774
       /**
2756
        * Volumetric extrusion M200
2775
        * Volumetric extrusion M200
2765
 
2784
 
2766
       #if EXTRUDERS == 1
2785
       #if EXTRUDERS == 1
2767
         CONFIG_ECHO_START();
2786
         CONFIG_ECHO_START();
2768
-        SERIAL_ECHOLNPAIR("  M200 D", LINEAR_UNIT(planner.filament_size[0]));
2769
-      #elif EXTRUDERS
2787
+        SERIAL_ECHOLNPAIR("  M200 S", int(parser.volumetric_enabled)
2788
+                              , " D", LINEAR_UNIT(planner.filament_size[0]),
2789
+                              #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
2790
+                                , " L", LINEAR_UNIT(planner.volumetric_extruder_limit[0])
2791
+                              #endif
2792
+                         );
2793
+      #else
2770
         LOOP_L_N(i, EXTRUDERS) {
2794
         LOOP_L_N(i, EXTRUDERS) {
2771
           CONFIG_ECHO_START();
2795
           CONFIG_ECHO_START();
2772
-          SERIAL_ECHOPGM("  M200");
2773
-          if (i) SERIAL_ECHOPAIR_P(SP_T_STR, int(i));
2774
-          SERIAL_ECHOLNPAIR(" D", LINEAR_UNIT(planner.filament_size[i]));
2796
+          SERIAL_ECHOLNPAIR("  M200 T", int(i)
2797
+                                , " D", LINEAR_UNIT(planner.filament_size[i])
2798
+                                #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
2799
+                                  , " L", LINEAR_UNIT(planner.volumetric_extruder_limit[i])
2800
+                                #endif
2801
+                           );
2775
         }
2802
         }
2803
+        CONFIG_ECHO_START();
2804
+        SERIAL_ECHOLNPAIR("  M200 S", int(parser.volumetric_enabled));
2776
       #endif
2805
       #endif
2777
-
2778
-      if (!parser.volumetric_enabled)
2779
-        CONFIG_ECHO_MSG("  M200 D0");
2780
-
2781
-    #endif // !NO_VOLUMETRICS
2806
+    #endif // EXTRUDERS && !NO_VOLUMETRICS
2782
 
2807
 
2783
     CONFIG_ECHO_HEADING("Steps per unit:");
2808
     CONFIG_ECHO_HEADING("Steps per unit:");
2784
     report_M92(!forReplay);
2809
     report_M92(!forReplay);

+ 47
- 1
Marlin/src/module/planner.cpp Datei anzeigen

171
         Planner::volumetric_multiplier[EXTRUDERS];  // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
171
         Planner::volumetric_multiplier[EXTRUDERS];  // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
172
 #endif
172
 #endif
173
 
173
 
174
+#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
175
+  float Planner::volumetric_extruder_limit[EXTRUDERS],          // max mm^3/sec the extruder is able to handle
176
+        Planner::volumetric_extruder_feedrate_limit[EXTRUDERS]; // pre calculated extruder feedrate limit based on volumetric_extruder_limit; pre-calculated to reduce computation in the planner
177
+#endif
178
+
174
 #if HAS_LEVELING
179
 #if HAS_LEVELING
175
   bool Planner::leveling_active = false; // Flag that auto bed leveling is enabled
180
   bool Planner::leveling_active = false; // Flag that auto bed leveling is enabled
176
   #if ABL_PLANAR
181
   #if ABL_PLANAR
1407
       volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
1412
       volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
1408
       refresh_e_factor(i);
1413
       refresh_e_factor(i);
1409
     }
1414
     }
1415
+    #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
1416
+      calculate_volumetric_extruder_limits(); // update volumetric_extruder_limits as well.
1417
+    #endif
1410
   }
1418
   }
1411
 
1419
 
1412
 #endif // !NO_VOLUMETRICS
1420
 #endif // !NO_VOLUMETRICS
1413
 
1421
 
1422
+#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
1423
+
1424
+  /**
1425
+   * Convert volumetric based limits into pre calculated extruder feedrate limits.
1426
+   */
1427
+  void Planner::calculate_volumetric_extruder_limit(const uint8_t e) {
1428
+    const float &lim = volumetric_extruder_limit[e], &siz = filament_size[e];
1429
+    volumetric_extruder_feedrate_limit[e] = (lim && siz) ? lim / CIRCLE_AREA(siz * 0.5f) : 0;
1430
+  }
1431
+  void Planner::calculate_volumetric_extruder_limits() {
1432
+    LOOP_L_N(e, EXTRUDERS) calculate_volumetric_extruder_limit(e);
1433
+  }
1434
+
1435
+#endif
1436
+
1414
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
1437
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
1415
   /**
1438
   /**
1416
    * Convert the ratio value given by the filament width sensor
1439
    * Convert the ratio value given by the filament width sensor
2077
         if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL)
2100
         if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL)
2078
           current_speed.e *= MIXING_STEPPERS;
2101
           current_speed.e *= MIXING_STEPPERS;
2079
       #endif
2102
       #endif
2103
+
2080
       const feedRate_t cs = ABS(current_speed.e),
2104
       const feedRate_t cs = ABS(current_speed.e),
2081
                    max_fr = settings.max_feedrate_mm_s[E_AXIS_N(extruder)]
2105
                    max_fr = settings.max_feedrate_mm_s[E_AXIS_N(extruder)]
2082
                             * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1);
2106
                             * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1);
2083
-      if (cs > max_fr) NOMORE(speed_factor, max_fr / cs);
2107
+
2108
+      if (cs > max_fr) NOMORE(speed_factor, max_fr / cs); //respect max feedrate on any movement (doesn't matter if E axes only or not)
2109
+      
2110
+      #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
2111
+        const feedRate_t max_vfr = volumetric_extruder_feedrate_limit[extruder] 
2112
+                                   * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1);
2113
+
2114
+        // TODO: Doesn't work properly for joined segments. Set MIN_STEPS_PER_SEGMENT 1 as workaround.
2115
+
2116
+        if (block->steps.a || block->steps.b || block->steps.c) {
2117
+
2118
+          if (max_vfr > 0 && cs > max_vfr) {
2119
+            NOMORE(speed_factor, max_vfr / cs); // respect volumetric extruder limit (if any)
2120
+            /* <-- add a slash to enable
2121
+            SERIAL_ECHOPAIR("volumetric extruder limit enforced: ", (cs * CIRCLE_AREA(filament_size[extruder] * 0.5f)));
2122
+            SERIAL_ECHOPAIR(" mm^3/s (", cs);
2123
+            SERIAL_ECHOPAIR(" mm/s) limited to ", (max_vfr * CIRCLE_AREA(filament_size[extruder] * 0.5f)));
2124
+            SERIAL_ECHOPAIR(" mm^3/s (", max_vfr);
2125
+            SERIAL_ECHOLNPGM(" mm/s)");
2126
+            //*/
2127
+          }
2128
+        }
2129
+      #endif
2084
     }
2130
     }
2085
   #endif
2131
   #endif
2086
 
2132
 

+ 22
- 3
Marlin/src/module/planner.h Datei anzeigen

333
                                                       // May be auto-adjusted by a filament width sensor
333
                                                       // May be auto-adjusted by a filament width sensor
334
     #endif
334
     #endif
335
 
335
 
336
+    #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
337
+      static float volumetric_extruder_limit[EXTRUDERS],          // Maximum mm^3/sec the extruder can handle
338
+                   volumetric_extruder_feedrate_limit[EXTRUDERS]; // Feedrate limit (mm/s) calculated from volume limit
339
+    #endif
340
+
336
     static planner_settings_t settings;
341
     static planner_settings_t settings;
337
 
342
 
338
     #if ENABLED(LASER_POWER_INLINE)
343
     #if ENABLED(LASER_POWER_INLINE)
473
     // Manage fans, paste pressure, etc.
478
     // Manage fans, paste pressure, etc.
474
     static void check_axes_activity();
479
     static void check_axes_activity();
475
 
480
 
476
-    // Update multipliers based on new diameter measurements
477
-    static void calculate_volumetric_multipliers();
478
-
479
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
481
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
480
       void apply_filament_width_sensor(const int8_t encoded_ratio);
482
       void apply_filament_width_sensor(const int8_t encoded_ratio);
481
 
483
 
489
 
491
 
490
     #if DISABLED(NO_VOLUMETRICS)
492
     #if DISABLED(NO_VOLUMETRICS)
491
 
493
 
494
+      // Update multipliers based on new diameter measurements
495
+      static void calculate_volumetric_multipliers();
496
+  
497
+      #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
498
+        // Update pre calculated extruder feedrate limits based on volumetric values
499
+        static void calculate_volumetric_extruder_limit(const uint8_t e);
500
+        static void calculate_volumetric_extruder_limits();
501
+      #endif
502
+
492
       FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) {
503
       FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) {
493
         filament_size[e] = v;
504
         filament_size[e] = v;
505
+        if (v > 0) volumetric_area_nominal = CIRCLE_AREA(v * 0.5); //TODO: should it be per extruder
494
         // make sure all extruders have some sane value for the filament size
506
         // make sure all extruders have some sane value for the filament size
495
         LOOP_L_N(i, COUNT(filament_size))
507
         LOOP_L_N(i, COUNT(filament_size))
496
           if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
508
           if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
498
 
510
 
499
     #endif
511
     #endif
500
 
512
 
513
+    #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
514
+      FORCE_INLINE static void set_volumetric_extruder_limit(const uint8_t e, const float &v) {
515
+        volumetric_extruder_limit[e] = v;
516
+        calculate_volumetric_extruder_limit(e);
517
+      }
518
+    #endif
519
+
501
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
520
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
502
 
521
 
503
       /**
522
       /**

Laden…
Abbrechen
Speichern