From 942c38c18bbc28cf2f68dd1aafa3dc9cf3b62c9d Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 19 May 2019 14:34:03 +0200 Subject: [PATCH] Minor reformatting --- Firmware/planner.cpp | 18 ++++++++++-------- Firmware/planner.h | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index 078abac4..0d0f3e36 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -1019,21 +1019,23 @@ Having the real displacement of the head, we can calculate the total movement le /** * Use LIN_ADVANCE for blocks if all these are true: * - * block->steps_e : This is a print move, because we checked for X, Y, Z steps before. - * extruder_advance_K : There is an advance factor set. - * delta_mm[E_AXIS] > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) + * block->steps_e : This is a print move, because we checked for X, Y, Z steps before. + * extruder_advance_K : There is an advance factor set. + * delta_mm[E_AXIS] > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) */ - block->use_advance_lead = block->steps_e.wide - && extruder_advance_K - && delta_mm[E_AXIS] > 0; + block->use_advance_lead = block->steps_e.wide + && extruder_advance_K + && delta_mm[E_AXIS] > 0; if (block->use_advance_lead) { block->e_D_ratio = (e - position_float[E_AXIS]) / sqrt(sq(x - position_float[X_AXIS]) + sq(y - position_float[Y_AXIS]) + sq(z - position_float[Z_AXIS])); - // Check for unusual high e_D ratio to detect if a retract move was combined with the last print move due to min. steps per segment. Never execute this with advance! - // This assumes 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. + // Check for unusual high e_D ratio to detect if a retract move was combined with the last + // print move due to min. steps per segment. Never execute this with advance! This assumes + // 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 (block->e_D_ratio > 3.0) block->use_advance_lead = false; else { diff --git a/Firmware/planner.h b/Firmware/planner.h index 56e1c66c..44c57ea5 100644 --- a/Firmware/planner.h +++ b/Firmware/planner.h @@ -110,10 +110,10 @@ typedef struct { // Pre-calculated division for the calculate_trapezoid_for_block() routine to run faster. 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 + 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 uint8_t advance_step_loops; // Number of stepper ticks for each advance isr