✨ ADVANCE_K per-extruder (#24821)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
committed by
Scott Lahteine
parent
8481264566
commit
0203e32c73
@ -227,7 +227,7 @@ float Planner::previous_nominal_speed;
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
float Planner::extruder_advance_K[EXTRUDERS]; // Initialized by settings.load()
|
||||
float Planner::extruder_advance_K[DISTINCT_E]; // Initialized by settings.load()
|
||||
#endif
|
||||
|
||||
#if HAS_POSITION_FLOAT
|
||||
@ -854,7 +854,7 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
if (block->la_advance_rate) {
|
||||
const float comp = extruder_advance_K[block->extruder] * block->steps.e / block->step_event_count;
|
||||
const float comp = extruder_advance_K[E_INDEX_N(block->extruder)] * block->steps.e / block->step_event_count;
|
||||
block->max_adv_steps = cruise_rate * comp;
|
||||
block->final_adv_steps = final_rate * comp;
|
||||
}
|
||||
@ -2541,7 +2541,7 @@ bool Planner::_populate_block(
|
||||
*
|
||||
* de > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves)
|
||||
*/
|
||||
use_advance_lead = esteps && extruder_advance_K[extruder] && de > 0;
|
||||
use_advance_lead = esteps && extruder_advance_K[E_INDEX_N(extruder)] && de > 0;
|
||||
|
||||
if (use_advance_lead) {
|
||||
float e_D_ratio = (target_float.e - position_float.e) /
|
||||
@ -2557,7 +2557,7 @@ bool Planner::_populate_block(
|
||||
use_advance_lead = false;
|
||||
else {
|
||||
// Scale E acceleration so that it will be possible to jump to the advance speed.
|
||||
const uint32_t max_accel_steps_per_s2 = MAX_E_JERK(extruder) / (extruder_advance_K[extruder] * e_D_ratio) * steps_per_mm;
|
||||
const uint32_t max_accel_steps_per_s2 = MAX_E_JERK(extruder) / (extruder_advance_K[E_INDEX_N(extruder)] * e_D_ratio) * steps_per_mm;
|
||||
if (TERN0(LA_DEBUG, accel > max_accel_steps_per_s2))
|
||||
SERIAL_ECHOLNPGM("Acceleration limited.");
|
||||
NOMORE(accel, max_accel_steps_per_s2);
|
||||
@ -2594,7 +2594,7 @@ bool Planner::_populate_block(
|
||||
|
||||
if (use_advance_lead) {
|
||||
// the Bresenham algorithm will convert this step rate into extruder steps
|
||||
block->la_advance_rate = extruder_advance_K[extruder] * block->acceleration_steps_per_s2;
|
||||
block->la_advance_rate = extruder_advance_K[E_INDEX_N(extruder)] * block->acceleration_steps_per_s2;
|
||||
|
||||
// reduce LA ISR frequency by calling it only often enough to ensure that there will
|
||||
// never be more than four extruder steps per call
|
||||
|
Reference in New Issue
Block a user