|
@@ -1999,7 +1999,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
1999
|
1999
|
if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
|
2000
|
2000
|
#endif
|
2001
|
2001
|
|
2002
|
|
- block->nominal_speed_sqr = sq(block->millimeters * inverse_secs); // (mm/sec)^2 Always > 0
|
|
2002
|
+ block->nominal_speed_sqr = sq(block->millimeters * inverse_secs); // (mm/sec)^2 Always > 0
|
2003
|
2003
|
block->nominal_rate = CEIL(block->step_event_count * inverse_secs); // (step/sec) Always > 0
|
2004
|
2004
|
|
2005
|
2005
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
|
@@ -2007,28 +2007,38 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
2007
|
2007
|
filwidth.advance_e(delta_mm.e);
|
2008
|
2008
|
#endif
|
2009
|
2009
|
|
2010
|
|
- // Calculate and limit speed in mm/sec for each axis
|
|
2010
|
+ // Calculate and limit speed in mm/sec
|
|
2011
|
+
|
2011
|
2012
|
xyze_float_t current_speed;
|
2012
|
2013
|
float speed_factor = 1.0f; // factor <1 decreases speed
|
2013
|
|
- LOOP_XYZE(i) {
|
2014
|
|
- #if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING)
|
2015
|
|
- // In worst case, only one extruder running, no change is needed.
|
2016
|
|
- // In best case, all extruders run the same amount, we can divide by MIXING_STEPPERS
|
2017
|
|
- float delta_mm_i = 0;
|
2018
|
|
- if (i == E_AXIS && mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL)
|
2019
|
|
- delta_mm_i = delta_mm.e / MIXING_STEPPERS;
|
2020
|
|
- else
|
2021
|
|
- delta_mm_i = delta_mm.e;
|
2022
|
|
- #else
|
2023
|
|
- const float delta_mm_i = delta_mm[i];
|
2024
|
|
- #endif
|
2025
|
|
- const feedRate_t cs = ABS(current_speed[i] = delta_mm_i * inverse_secs);
|
2026
|
|
- #if ENABLED(DISTINCT_E_FACTORS)
|
2027
|
|
- if (i == E_AXIS) i += extruder;
|
2028
|
|
- #endif
|
2029
|
|
- if (cs > settings.max_feedrate_mm_s[i]) NOMORE(speed_factor, settings.max_feedrate_mm_s[i] / cs);
|
|
2014
|
+
|
|
2015
|
+ // Linear axes first with less logic
|
|
2016
|
+ LOOP_XYZ(i) {
|
|
2017
|
+ current_speed[i] = delta_mm[i] * inverse_secs;
|
|
2018
|
+ const feedRate_t cs = ABS(current_speed[i]),
|
|
2019
|
+ max_fr = settings.max_feedrate_mm_s[i];
|
|
2020
|
+ if (cs > max_fr) NOMORE(speed_factor, max_fr / cs);
|
2030
|
2021
|
}
|
2031
|
2022
|
|
|
2023
|
+ // Limit speed on extruders, if any
|
|
2024
|
+ #if EXTRUDERS
|
|
2025
|
+ {
|
|
2026
|
+ current_speed.e = delta_mm.e * inverse_secs;
|
|
2027
|
+ #if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING)
|
|
2028
|
+ // Move all mixing extruders at the specified rate
|
|
2029
|
+ if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL)
|
|
2030
|
+ current_speed.e *= MIXING_STEPPERS;
|
|
2031
|
+ #endif
|
|
2032
|
+ const feedRate_t cs = ABS(current_speed.e),
|
|
2033
|
+ max_fr = (settings.max_feedrate_mm_s[E_AXIS_N(extruder)]
|
|
2034
|
+ #if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING)
|
|
2035
|
+ * MIXING_STEPPERS
|
|
2036
|
+ #endif
|
|
2037
|
+ );
|
|
2038
|
+ if (cs > max_fr) NOMORE(speed_factor, max_fr / cs);
|
|
2039
|
+ }
|
|
2040
|
+ #endif
|
|
2041
|
+
|
2032
|
2042
|
// Max segment time in µs.
|
2033
|
2043
|
#ifdef XY_FREQUENCY_LIMIT
|
2034
|
2044
|
|