forked from Mirrors/Marlin
🐛 FT Motion respect linearAdvEna flag
This commit is contained in:
@@ -2415,9 +2415,10 @@ bool Planner::_populate_block(
|
||||
* Check the appropriate K value for Standard or Fixed-Time Motion.
|
||||
*/
|
||||
if (esteps && dm.e) {
|
||||
const bool ftm_active = TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.active);
|
||||
const bool ftm_active = TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.active),
|
||||
ftm_la_active = TERN0(FTM_HAS_LIN_ADVANCE, ftm_active && ftMotion.cfg.linearAdvEna);
|
||||
const float advK = ftm_active
|
||||
? TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.linearAdvK)
|
||||
? (ftm_la_active ? TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.linearAdvK) : 0)
|
||||
: TERN0(HAS_ROUGH_LIN_ADVANCE, extruder_advance_K[E_INDEX_N(extruder)]);
|
||||
if (advK) {
|
||||
float e_D_ratio = (target_float.e - position_float.e) /
|
||||
@@ -2437,7 +2438,7 @@ bool Planner::_populate_block(
|
||||
const uint32_t max_accel_steps_per_s2 = (MAX_E_JERK(extruder) / (advK * e_D_ratio)) * steps_per_mm;
|
||||
if (accel > max_accel_steps_per_s2) {
|
||||
accel = max_accel_steps_per_s2;
|
||||
if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited.");
|
||||
if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited to max_accel_steps_per_s2 (", max_accel_steps_per_s2, ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2438,6 +2438,7 @@ hal_timer_t Stepper::block_phase_isr() {
|
||||
acceleration_time += interval;
|
||||
deceleration_time = 0; // Reset since we're doing acceleration first.
|
||||
|
||||
// Apply Nonlinear Extrusion, if enabled
|
||||
calc_nonlinear_e(acc_step_rate << oversampling_factor);
|
||||
|
||||
#if HAS_ROUGH_LIN_ADVANCE
|
||||
@@ -2502,6 +2503,7 @@ hal_timer_t Stepper::block_phase_isr() {
|
||||
interval = calc_multistep_timer_interval(step_rate << oversampling_factor);
|
||||
deceleration_time += interval;
|
||||
|
||||
// Apply Nonlinear Extrusion, if enabled
|
||||
calc_nonlinear_e(step_rate << oversampling_factor);
|
||||
|
||||
#if HAS_ROUGH_LIN_ADVANCE
|
||||
@@ -2555,6 +2557,7 @@ hal_timer_t Stepper::block_phase_isr() {
|
||||
TERN_(SMOOTH_LIN_ADVANCE, curr_step_rate = current_block->nominal_rate;)
|
||||
deceleration_time = ticks_nominal / 2;
|
||||
|
||||
// Apply Nonlinear Extrusion, if enabled
|
||||
calc_nonlinear_e(current_block->nominal_rate << oversampling_factor);
|
||||
|
||||
#if HAS_ROUGH_LIN_ADVANCE
|
||||
@@ -2826,6 +2829,7 @@ hal_timer_t Stepper::block_phase_isr() {
|
||||
// Initialize ac/deceleration time as if half the time passed.
|
||||
acceleration_time = deceleration_time = interval / 2;
|
||||
|
||||
// Apply Nonlinear Extrusion, if enabled
|
||||
calc_nonlinear_e(current_block->initial_rate << oversampling_factor);
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
|
||||
Reference in New Issue
Block a user