Compine planner use_advance_lead with other flags
This commit is contained in:
parent
51f450f927
commit
57e7618b31
|
|
@ -229,7 +229,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_speed, float exit
|
|||
#ifdef LIN_ADVANCE
|
||||
uint16_t final_adv_steps = 0;
|
||||
uint16_t max_adv_steps = 0;
|
||||
if (block->use_advance_lead) {
|
||||
if (block->flag & BLOCK_FLAG_USE_ADVANCE_LEAD) {
|
||||
final_adv_steps = final_rate * block->adv_comp;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -240,7 +240,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_speed, float exit
|
|||
if (accel_decel_steps < block->step_event_count.wide) {
|
||||
plateau_steps = block->step_event_count.wide - accel_decel_steps;
|
||||
#ifdef LIN_ADVANCE
|
||||
if (block->use_advance_lead)
|
||||
if (block->flag & BLOCK_FLAG_USE_ADVANCE_LEAD)
|
||||
max_adv_steps = block->nominal_rate * block->adv_comp;
|
||||
#endif
|
||||
} else {
|
||||
|
|
@ -277,7 +277,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_speed, float exit
|
|||
}
|
||||
|
||||
#ifdef LIN_ADVANCE
|
||||
if (block->use_advance_lead) {
|
||||
if (block->flag & BLOCK_FLAG_USE_ADVANCE_LEAD) {
|
||||
if(!accelerate_steps || !decelerate_steps) {
|
||||
// accelerate_steps=0: deceleration-only ramp, max_rate is effectively unused
|
||||
// decelerate_steps=0: acceleration-only ramp, max_rate _is_ final_rate
|
||||
|
|
@ -1010,7 +1010,7 @@ Having the real displacement of the head, we can calculate the total movement le
|
|||
{
|
||||
accel = ceil(cs.retract_acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
|
||||
#ifdef LIN_ADVANCE
|
||||
block->use_advance_lead = false;
|
||||
block->flag &= ~BLOCK_FLAG_USE_ADVANCE_LEAD;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
@ -1025,10 +1025,10 @@ Having the real displacement of the head, we can calculate the total movement le
|
|||
* delta_mm[E_AXIS] >= 0 : Extruding or traveling, but _not_ retracting.
|
||||
* |delta_mm[Z_AXIS]| < 0.5 : Z is only moved for leveling (_not_ for priming)
|
||||
*/
|
||||
block->use_advance_lead = extruder_advance_K > 0
|
||||
&& delta_mm[E_AXIS] >= 0
|
||||
&& fabs(delta_mm[Z_AXIS]) < 0.5;
|
||||
if (block->use_advance_lead) {
|
||||
if (extruder_advance_K > 0
|
||||
&& delta_mm[E_AXIS] >= 0
|
||||
&& fabs(delta_mm[Z_AXIS]) < 0.5) {
|
||||
block->flag |= BLOCK_FLAG_USE_ADVANCE_LEAD;
|
||||
#ifdef LA_FLOWADJ
|
||||
// M221/FLOW should change uniformly the extrusion thickness
|
||||
float delta_e = (e - position_float[E_AXIS]) / extruder_multiplier[extruder];
|
||||
|
|
@ -1049,7 +1049,7 @@ Having the real displacement of the head, we can calculate the total movement le
|
|||
// no one will use a retract length of 0mm < retr_length < ~0.2mm and no one will print
|
||||
// 100mm wide lines using 3mm filament or 35mm wide lines using 1.75mm filament.
|
||||
if (e_D_ratio > 3.0)
|
||||
block->use_advance_lead = false;
|
||||
block->flag &= ~BLOCK_FLAG_USE_ADVANCE_LEAD;
|
||||
else if (e_D_ratio > 0) {
|
||||
const uint32_t max_accel_steps_per_s2 = ceil(cs.max_jerk[E_AXIS] / (extruder_advance_K * e_D_ratio) * steps_per_mm);
|
||||
if (accel > max_accel_steps_per_s2) {
|
||||
|
|
@ -1201,7 +1201,7 @@ Having the real displacement of the head, we can calculate the total movement le
|
|||
block->speed_factor = block->nominal_rate / block->nominal_speed;
|
||||
|
||||
#ifdef LIN_ADVANCE
|
||||
if (block->use_advance_lead) {
|
||||
if (block->flag & BLOCK_FLAG_USE_ADVANCE_LEAD) {
|
||||
// calculate the compression ratio for the segment (the required advance steps are computed
|
||||
// during trapezoid planning)
|
||||
float adv_comp = extruder_advance_K * e_D_ratio * cs.axis_steps_per_mm[E_AXIS]; // (step/(mm/s))
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ enum BlockFlag {
|
|||
BLOCK_FLAG_E_RESET = 16,
|
||||
// Block is being executed by the stepper ISR
|
||||
BLOCK_FLAG_BUSY = 32,
|
||||
|
||||
// Whether the block uses LA
|
||||
BLOCK_FLAG_USE_ADVANCE_LEAD = 64,
|
||||
};
|
||||
|
||||
union dda_isteps_t
|
||||
|
|
@ -113,7 +114,6 @@ typedef struct {
|
|||
float speed_factor;
|
||||
|
||||
#ifdef LIN_ADVANCE
|
||||
bool use_advance_lead; // Whether the current block uses LA
|
||||
uint16_t advance_rate, // Step-rate for extruder speed
|
||||
max_adv_steps, // max. advance steps to get cruising speed pressure (not always nominal_speed!)
|
||||
final_adv_steps; // advance steps due to exit speed
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ FORCE_INLINE void stepper_next_block()
|
|||
acceleration_time = calc_timer(acc_step_rate, step_loops);
|
||||
|
||||
#ifdef LIN_ADVANCE
|
||||
if (current_block->use_advance_lead) {
|
||||
if (current_block->flag & BLOCK_FLAG_USE_ADVANCE_LEAD) {
|
||||
target_adv_steps = current_block->max_adv_steps;
|
||||
}
|
||||
e_steps = 0;
|
||||
|
|
@ -841,7 +841,7 @@ FORCE_INLINE void isr() {
|
|||
_NEXT_ISR(timer);
|
||||
acceleration_time += timer;
|
||||
#ifdef LIN_ADVANCE
|
||||
if (current_block->use_advance_lead) {
|
||||
if (current_block->flag & BLOCK_FLAG_USE_ADVANCE_LEAD) {
|
||||
if (step_events_completed.wide <= (unsigned long int)step_loops) {
|
||||
la_state = ADV_INIT | ADV_ACC_VARY;
|
||||
if (e_extruding && current_adv_steps > target_adv_steps)
|
||||
|
|
@ -870,7 +870,7 @@ FORCE_INLINE void isr() {
|
|||
deceleration_time += timer;
|
||||
|
||||
#ifdef LIN_ADVANCE
|
||||
if (current_block->use_advance_lead) {
|
||||
if (current_block->flag & BLOCK_FLAG_USE_ADVANCE_LEAD) {
|
||||
if (step_events_completed.wide <= current_block->decelerate_after + step_loops) {
|
||||
target_adv_steps = current_block->final_adv_steps;
|
||||
la_state = ADV_INIT | ADV_ACC_VARY;
|
||||
|
|
@ -888,7 +888,7 @@ FORCE_INLINE void isr() {
|
|||
step_loops_nominal = step_loops;
|
||||
|
||||
#ifdef LIN_ADVANCE
|
||||
if(current_block->use_advance_lead) {
|
||||
if(current_block->flag & BLOCK_FLAG_USE_ADVANCE_LEAD) {
|
||||
// Due to E-jerk, there can be discontinuities in pressure state where an
|
||||
// acceleration or deceleration can be skipped or joined with the previous block.
|
||||
// If LA was not previously active, re-check the pressure level
|
||||
|
|
|
|||
Loading…
Reference in New Issue