From 2bd252b50149c860cf37d488762abcf70a83f78d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 23 Feb 2018 00:53:29 -0600 Subject: [PATCH] [2.0.x] LIN_ADVANCE v1.5 (#9712) --- Marlin/Configuration_adv.h | 46 ++-- Marlin/src/config/default/Configuration_adv.h | 46 ++-- .../AlephObjects/TAZ4/Configuration_adv.h | 46 ++-- .../examples/Anet/A6/Configuration_adv.h | 46 ++-- .../examples/Anet/A8/Configuration_adv.h | 46 ++-- .../examples/Azteeg/X5GT/Configuration_adv.h | 46 ++-- .../examples/BIBO/TouchX/Configuration_adv.h | 46 ++-- .../examples/BQ/Hephestos/Configuration_adv.h | 46 ++-- .../BQ/Hephestos_2/Configuration_adv.h | 46 ++-- .../examples/BQ/WITBOX/Configuration_adv.h | 46 ++-- .../examples/Cartesio/Configuration_adv.h | 46 ++-- .../Creality/CR-10/Configuration_adv.h | 46 ++-- .../Creality/CR-10S/Configuration_adv.h | 46 ++-- .../Creality/Ender/Configuration_adv.h | 46 ++-- .../config/examples/Felix/Configuration_adv.h | 46 ++-- .../FolgerTech/i3-2020/Configuration_adv.h | 46 ++-- .../Infitary/i3-M508/Configuration_adv.h | 46 ++-- .../examples/JGAurora/A5/Configuration_adv.h | 46 ++-- .../examples/MakerParts/Configuration_adv.h | 46 ++-- .../examples/Malyan/M150/Configuration_adv.h | 46 ++-- .../examples/Malyan/M200/Configuration_adv.h | 46 ++-- .../Micromake/C1/enhanced/Configuration_adv.h | 46 ++-- .../examples/Mks/Sbase/Configuration_adv.h | 46 ++-- .../examples/RigidBot/Configuration_adv.h | 46 ++-- .../config/examples/SCARA/Configuration_adv.h | 46 ++-- .../examples/Sanguinololu/Configuration_adv.h | 46 ++-- .../examples/TheBorg/Configuration_adv.h | 46 ++-- .../examples/TinyBoy2/Configuration_adv.h | 46 ++-- .../UltiMachine/Archim2/Configuration_adv.h | 46 ++-- .../Velleman/K8200/Configuration_adv.h | 46 ++-- .../Velleman/K8400/Configuration_adv.h | 46 ++-- .../Wanhao/Duplicator 6/Configuration_adv.h | 46 ++-- .../FLSUN/auto_calibrate/Configuration_adv.h | 46 ++-- .../delta/FLSUN/kossel/Configuration_adv.h | 46 ++-- .../FLSUN/kossel_mini/Configuration_adv.h | 46 ++-- .../delta/generic/Configuration_adv.h | 46 ++-- .../delta/kossel_mini/Configuration_adv.h | 46 ++-- .../delta/kossel_pro/Configuration_adv.h | 46 ++-- .../delta/kossel_xl/Configuration_adv.h | 46 ++-- .../gCreate/gMax1.5+/Configuration_adv.h | 46 ++-- .../examples/makibox/Configuration_adv.h | 46 ++-- .../tvrrug/Round2/Configuration_adv.h | 46 ++-- .../config/examples/wt150/Configuration_adv.h | 46 ++-- Marlin/src/gcode/feature/advance/M900.cpp | 29 +-- Marlin/src/inc/Conditionals_LCD.h | 6 - Marlin/src/inc/SanityCheck.h | 6 +- Marlin/src/lcd/ultralcd.cpp | 4 +- Marlin/src/module/configuration_store.cpp | 23 +- Marlin/src/module/planner.cpp | 234 ++++++++++-------- Marlin/src/module/planner.h | 19 +- Marlin/src/module/stepper.cpp | 206 ++++++++------- Marlin/src/module/stepper.h | 56 ++--- 52 files changed, 890 insertions(+), 1671 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index a528802665..e916b1c0d1 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index a528802665..e916b1c0d1 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index cea8663117..69e98af903 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index e5970eeb3b..bfeb7618dd 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index a2597b3cdc..11b6a69ae6 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h index c5eeafaad3..7a2935b0a3 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h @@ -712,43 +712,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h index 6377d2e4da..36efb6bfe6 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index 0051f608c4..84fec1e824 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index 06f33d4c7a..b29e62741d 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index 0051f608c4..84fec1e824 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 8d86f0235a..bf221649a1 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index 8d5cf3f806..fbb925f1f8 100755 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h index d4a2e5f97a..b9ddd70349 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h index 6ed16d050e..6fc9f337aa 100644 --- a/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index 29efba3dce..0d801da1fe 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index 7d1b2726a5..96f13ffd2c 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index 644d356e66..5c6d96d7fc 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h index f0fb352add..b02cabc981 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h index 628e94e29c..4743a0de8e 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index f9f50061e2..ad985d86e5 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h index 189b4daf32..567ddd5526 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index 241914681f..72330b0abf 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index 909584283f..8e66b77881 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -719,43 +719,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index 138266a96f..3eb5ac70fc 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index fe21220d13..fc5ec71296 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 26f64f4588..f4ef64b2d8 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/TheBorg/Configuration_adv.h b/Marlin/src/config/examples/TheBorg/Configuration_adv.h index 5cb450a584..6a206dba90 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h +++ b/Marlin/src/config/examples/TheBorg/Configuration_adv.h @@ -708,43 +708,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index 057f4438a9..e1ceb34f28 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index bb0a617160..0a6644e113 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index fd6b4e344a..f6e585ee39 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -724,43 +724,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 140 // start value for PLA on K8200 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index d22b7547bb..757b8859ee 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h index 2ff90dc526..bf00e027ac 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -713,43 +713,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ #define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 0 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 442978a49b..155c2912c4 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -713,43 +713,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h index ea12964b77..84c56751c1 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h @@ -713,43 +713,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index 85d281b066..3703cbad93 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -713,43 +713,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index 85d281b066..3703cbad93 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -713,43 +713,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index 85d281b066..3703cbad93 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -713,43 +713,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h index 2e1c120b27..4d4ee1b725 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -718,43 +718,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index 311d1de362..6c4a8449f8 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -713,43 +713,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 96a6abab6d..d25e240a72 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index 205be25281..ab79ea66dd 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index c8c302689b..33e048c3e4 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -711,43 +711,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 720177f83b..1d9bab31ac 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -712,43 +712,25 @@ // @section extruder /** - * Implementation of linear pressure control + * Linear Pressure Control v1.5 * - * Assumption: advance = k * (delta velocity) + * Assumption: advance [steps] = k * (delta velocity [steps/s]) * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ //#define LIN_ADVANCE - #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Průša Control) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index 074dc506a2..4f95ee8859 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -29,34 +29,19 @@ #include "../../../module/stepper.h" /** - * M900: Set and/or Get advance K factor and WH/D ratio + * M900: Set and/or Get advance K factor * * K Set advance K factor - * R Set ratio directly (overrides WH/D) - * W H D Set ratio from WH/D */ void GcodeSuite::M900() { - stepper.synchronize(); + stepper.synchronize(); - const float newK = parser.floatval('K', -1); - if (newK >= 0) planner.extruder_advance_k = newK; + const float newK = parser.floatval('K', -1); + if (newK >= 0) planner.extruder_advance_K = newK; - float newR = parser.floatval('R', -1); - if (newR < 0) { - const float newD = parser.floatval('D', -1), - newW = parser.floatval('W', -1), - newH = parser.floatval('H', -1); - if (newD >= 0 && newW >= 0 && newH >= 0) - newR = newD ? (newW * newH) / CIRCLE_AREA(newD * 0.5) : 0; - } - if (newR >= 0) planner.advance_ed_ratio = newR; - - SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Advance K=", planner.extruder_advance_k); - SERIAL_ECHOPGM(" E/D="); - const float ratio = planner.advance_ed_ratio; - if (ratio) SERIAL_ECHO(ratio); else SERIAL_ECHOPGM("Auto"); - SERIAL_EOL(); + SERIAL_ECHO_START(); + SERIAL_ECHOPAIR("Advance K=", planner.extruder_advance_K); + SERIAL_EOL(); } #endif // LIN_ADVANCE diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 6daff521b0..4eb55111da 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -399,7 +399,6 @@ * HOTENDS - Number of hotends, whether connected or separate * E_STEPPERS - Number of actual E stepper motors * E_MANUAL - Number of E steppers for LCD move options - * TOOL_E_INDEX - Index to use when getting/setting the tool state * */ #if ENABLED(SINGLENOZZLE) || ENABLED(MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset @@ -426,24 +425,19 @@ #if EXTRUDERS > 4 #define E_STEPPERS 3 #define E_MANUAL 3 - #define TOOL_E_INDEX current_block->active_extruder #elif EXTRUDERS > 2 #define E_STEPPERS 2 #define E_MANUAL 2 - #define TOOL_E_INDEX current_block->active_extruder #else #define E_STEPPERS 1 - #define TOOL_E_INDEX 0 #endif #define E_MANUAL E_STEPPERS #elif ENABLED(MIXING_EXTRUDER) #define E_STEPPERS MIXING_STEPPERS #define E_MANUAL 1 - #define TOOL_E_INDEX 0 #else #define E_STEPPERS EXTRUDERS #define E_MANUAL EXTRUDERS - #define TOOL_E_INDEX current_block->active_extruder #endif /** diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index e90c88c0a7..e0f7effff5 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -223,6 +223,8 @@ #error "MIN_RETRACT is now MIN_AUTORETRACT and MAX_AUTORETRACT. Please update your Configuration_adv.h." #elif defined(ADVANCE) #error "ADVANCE was removed in Marlin 1.1.6. Please use LIN_ADVANCE." +#elif defined(LIN_ADVANCE_E_D_RATIO) + #error "LIN_ADVANCE (1.5) no longer uses LIN_ADVANCE_E_D_RATIO. Check your configuration." #elif defined(NEOPIXEL_RGBW_LED) #error "NEOPIXEL_RGBW_LED is now NEOPIXEL_LED. Please update your configuration." #elif defined(UBL_MESH_INSET) @@ -552,10 +554,6 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif #endif -#if ENABLED(LIN_ADVANCE) && !IS_CARTESIAN - #error "Sorry! LIN_ADVANCE is only compatible with Cartesian." -#endif - /** * Parking Extruder requirements */ diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 4a7e703924..7fcc653c3f 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -3228,7 +3228,7 @@ void kill_screen(const char* lcd_msg) { #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu); #elif ENABLED(LIN_ADVANCE) - MENU_ITEM_EDIT(float3, MSG_ADVANCE_K, &planner.extruder_advance_k, 0, 999); + MENU_ITEM_EDIT(float32, MSG_ADVANCE_K, &planner.extruder_advance_K, 0, 999); #endif #if HAS_LCD_CONTRAST @@ -3742,7 +3742,7 @@ void kill_screen(const char* lcd_msg) { MENU_BACK(MSG_CONTROL); #if ENABLED(LIN_ADVANCE) - MENU_ITEM_EDIT(float3, MSG_ADVANCE_K, &planner.extruder_advance_k, 0, 999); + MENU_ITEM_EDIT(float32, MSG_ADVANCE_K, &planner.extruder_advance_K, 0, 999); #endif #if DISABLED(NO_VOLUMETRICS) diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index ace7f73c1f..e4337e423e 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -37,7 +37,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V51" +#define EEPROM_VERSION "V52" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -225,8 +225,7 @@ typedef struct SettingsDataStruct { // // LIN_ADVANCE // - float planner_extruder_advance_k, // M900 K planner.extruder_advance_k - planner_advance_ed_ratio; // M900 WHD planner.advance_ed_ratio + float planner_extruder_advance_K; // M900 K planner.extruder_advance_K // // HAS_MOTOR_CURRENT_PWM @@ -751,15 +750,13 @@ void MarlinSettings::postprocess() { // Linear Advance // - _FIELD_TEST(planner_extruder_advance_k); + _FIELD_TEST(planner_extruder_advance_K); #if ENABLED(LIN_ADVANCE) - EEPROM_WRITE(planner.extruder_advance_k); - EEPROM_WRITE(planner.advance_ed_ratio); + EEPROM_WRITE(planner.extruder_advance_K); #else dummy = 0.0f; EEPROM_WRITE(dummy); - EEPROM_WRITE(dummy); #endif _FIELD_TEST(motor_current_setting); @@ -1301,14 +1298,12 @@ void MarlinSettings::postprocess() { // Linear Advance // - _FIELD_TEST(planner_extruder_advance_k); + _FIELD_TEST(planner_extruder_advance_K); #if ENABLED(LIN_ADVANCE) - EEPROM_READ(planner.extruder_advance_k); - EEPROM_READ(planner.advance_ed_ratio); + EEPROM_READ(planner.extruder_advance_K); #else EEPROM_READ(dummy); - EEPROM_READ(dummy); #endif // @@ -1832,8 +1827,7 @@ void MarlinSettings::reset( #endif #if ENABLED(LIN_ADVANCE) - planner.extruder_advance_k = LIN_ADVANCE_K; - planner.advance_ed_ratio = LIN_ADVANCE_E_D_RATIO; + planner.extruder_advance_K = LIN_ADVANCE_K; #endif #if HAS_MOTOR_CURRENT_PWM @@ -2409,8 +2403,7 @@ void MarlinSettings::reset( SERIAL_ECHOLNPGM_P(port, "Linear Advance:"); } CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M900 K", planner.extruder_advance_k); - SERIAL_ECHOLNPAIR_P(port, " R", planner.advance_ed_ratio); + SERIAL_ECHOLNPAIR_P(port, " M900 K", planner.extruder_advance_K); #endif #if HAS_MOTOR_CURRENT_PWM diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index e06b0f43f5..edac7b9111 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -185,11 +185,8 @@ float Planner::previous_speed[NUM_AXIS], #endif #if ENABLED(LIN_ADVANCE) - float Planner::extruder_advance_k, // Initialized by settings.load() - Planner::advance_ed_ratio, // Initialized by settings.load() - Planner::position_float[XYZE], // Needed for accurate maths. Steps cannot be used! - Planner::lin_dist_xy, - Planner::lin_dist_e; + float Planner::extruder_advance_K, // Initialized by settings.load() + Planner::position_float[XYZE]; // Needed for accurate maths. Steps cannot be used! #endif #if ENABLED(ULTRA_LCD) @@ -364,6 +361,13 @@ void Planner::recalculate_trapezoids() { // NOTE: Entry and exit factors always > 0 by all previous logic operations. const float nomr = 1.0 / current->nominal_speed; calculate_trapezoid_for_block(current, current->entry_speed * nomr, next->entry_speed * nomr); + #if ENABLED(LIN_ADVANCE) + if (current->use_advance_lead) { + const float comp = current->e_D_ratio * extruder_advance_K * axis_steps_per_mm[E_AXIS]; + current->max_adv_steps = current->nominal_speed * comp; + current->final_adv_steps = next->entry_speed * comp; + } + #endif CBI(current->flag, BLOCK_BIT_RECALCULATE); // Reset current only to ensure next trapezoid is computed } } @@ -373,6 +377,13 @@ void Planner::recalculate_trapezoids() { if (next) { const float nomr = 1.0 / next->nominal_speed; calculate_trapezoid_for_block(next, next->entry_speed * nomr, (MINIMUM_PLANNER_SPEED) * nomr); + #if ENABLED(LIN_ADVANCE) + if (next->use_advance_lead) { + const float comp = next->e_D_ratio * extruder_advance_K * axis_steps_per_mm[E_AXIS]; + next->max_adv_steps = next->nominal_speed * comp; + next->final_adv_steps = (MINIMUM_PLANNER_SPEED) * comp; + } + #endif CBI(next->flag, BLOCK_BIT_RECALCULATE); } } @@ -730,7 +741,12 @@ void Planner::check_axes_activity() { * fr_mm_s - (target) speed of the move * extruder - target extruder */ -void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const uint8_t extruder, const float &millimeters /*= 0.0*/) { +void Planner::_buffer_steps(const int32_t (&target)[XYZE] + #if ENABLED(LIN_ADVANCE) + , const float (&target_float)[XYZE] + #endif + , float fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/ +) { const int32_t da = target[A_AXIS] - position[A_AXIS], db = target[B_AXIS] - position[B_AXIS], @@ -751,13 +767,14 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const SERIAL_ECHOLNPGM(" steps)"); //*/ - // If LIN_ADVANCE is disabled then do E move prevention with integers - // Otherwise it's done in _buffer_segment. - #if DISABLED(LIN_ADVANCE) && (ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)) + #if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE) if (de) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (thermalManager.tooColdToExtrude(extruder)) { position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part + #if ENABLED(LIN_ADVANCE) + position_float[E_AXIS] = target_float[E_AXIS]; + #endif de = 0; // no difference SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); @@ -766,13 +783,16 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const #if ENABLED(PREVENT_LENGTHY_EXTRUDE) if (labs(de * e_factor[extruder]) > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part + #if ENABLED(LIN_ADVANCE) + position_float[E_AXIS] = target_float[E_AXIS]; + #endif de = 0; // no difference SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); } #endif // PREVENT_LENGTHY_EXTRUDE } - #endif // !LIN_ADVANCE && (PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE) + #endif // PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE // Compute direction bit-mask for this block uint8_t dm = 0; @@ -1189,6 +1209,9 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const if (!block->steps[A_AXIS] && !block->steps[B_AXIS] && !block->steps[C_AXIS]) { // convert to: acceleration steps/sec^2 accel = CEIL(retract_acceleration * steps_per_mm); + #if ENABLED(LIN_ADVANCE) + block->use_advance_lead = false; + #endif } else { #define LIMIT_ACCEL_LONG(AXIS,INDX) do{ \ @@ -1208,6 +1231,47 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const // Start with print or travel acceleration accel = CEIL((esteps ? acceleration : travel_acceleration) * steps_per_mm); + #if ENABLED(LIN_ADVANCE) + /** + * + * Use LIN_ADVANCE for blocks if all these are true: + * + * esteps : This is a print move, because we checked for A, B, C steps before. + * + * extruder_advance_K : There is an advance factor set. + * + * de > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) + */ + block->use_advance_lead = esteps + && extruder_advance_K + && de > 0; + + if (block->use_advance_lead) { + block->e_D_ratio = (target_float[E_AXIS] - position_float[E_AXIS]) / + #if IS_KINEMATIC + block->millimeters + #else + SQRT(sq(target_float[X_AXIS] - position_float[X_AXIS]) + + sq(target_float[Y_AXIS] - position_float[Y_AXIS]) + + sq(target_float[Z_AXIS] - position_float[Z_AXIS])) + #endif + ; + + // 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 { + const uint32_t max_accel_steps_per_s2 = max_jerk[E_AXIS] / (extruder_advance_K * block->e_D_ratio) * steps_per_mm; + #if ENABLED(LA_DEBUG) + if (accel > max_accel_steps_per_s2) + SERIAL_ECHOLNPGM("Acceleration limited."); + #endif + NOMORE(accel, max_accel_steps_per_s2); + } + } + #endif + #if ENABLED(DISTINCT_E_FACTORS) #define ACCEL_IDX extruder #else @@ -1230,7 +1294,18 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const } block->acceleration_steps_per_s2 = accel; block->acceleration = accel / steps_per_mm; - block->acceleration_rate = (long)(accel * 16777216.0 / (HAL_STEPPER_TIMER_RATE)); // 16777216 = <<24 + block->acceleration_rate = (long)(accel * 16777216.0 / ((F_CPU) * 0.125)); // * 8.388608 + #if ENABLED(LIN_ADVANCE) + if (block->use_advance_lead) { + block->advance_speed = ((F_CPU) * 0.125) / (extruder_advance_K * block->e_D_ratio * block->acceleration * axis_steps_per_mm[E_AXIS_N]); + #if ENABLED(LA_DEBUG) + if (extruder_advance_K * block->e_D_ratio * block->acceleration * 2 < block->nominal_speed * block->e_D_ratio) + SERIAL_ECHOLNPGM("More than 2 steps per eISR loop executed."); + if (block->advance_speed < 200) + SERIAL_ECHOLNPGM("eISR running at > 10kHz."); + #endif + } + #endif // Initial limit on the segment entry velocity float vmax_junction; @@ -1386,41 +1461,15 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const previous_nominal_speed = block->nominal_speed; previous_safe_speed = safe_speed; - #if ENABLED(LIN_ADVANCE) - /** - * - * Use LIN_ADVANCE for blocks if all these are true: - * - * esteps && (block->steps[X_AXIS] || block->steps[Y_AXIS]) : This is a print move - * - * extruder_advance_k : There is an advance factor set. - * - * esteps != block->step_event_count : A problem occurs if the move before a retract is too small. - * In that case, the retract and move will be executed together. - * This leads to too many advance steps due to a huge e_acceleration. - * The math is good, but we must avoid retract moves with advance! - * lin_dist_e > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) - */ - block->use_advance_lead = esteps && (block->steps[X_AXIS] || block->steps[Y_AXIS]) - && extruder_advance_k - && (uint32_t)esteps != block->step_event_count - && lin_dist_e > 0; - if (block->use_advance_lead) - block->abs_adv_steps_multiplier8 = LROUND( - extruder_advance_k - * (UNEAR_ZERO(advance_ed_ratio) ? lin_dist_e / lin_dist_xy : advance_ed_ratio) // Use the fixed ratio, if set - * (block->nominal_speed / (float)block->nominal_rate) - * axis_steps_per_mm[E_AXIS_N] * 256.0 - ); - - #endif // LIN_ADVANCE - // Move buffer head block_buffer_head = next_buffer_head; // Update the position (only when a move was queued) static_assert(COUNT(target) > 1, "Parameter to _buffer_steps must be (&target)[XYZE]!"); COPY(position, target); + #if ENABLED(LIN_ADVANCE) + COPY(position_float, target_float); + #endif recalculate(); @@ -1438,7 +1487,7 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const * extruder - target extruder * millimeters - the length of the movement, if known */ -void Planner::buffer_segment(const float &a, const float &b, const float &c, const float &e, const float &fr_mm_s, const uint8_t extruder, const float &millimeters /*= 0.0*/) { +void Planner::buffer_segment(const float &a, const float &b, const float &c, const float &e, const float &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/) { // When changing extruders recalculate steps corresponding to the E position #if ENABLED(DISTINCT_E_FACTORS) if (last_extruder != extruder && axis_steps_per_mm[E_AXIS_N] != axis_steps_per_mm[E_AXIS + last_extruder]) { @@ -1456,6 +1505,18 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con LROUND(e * axis_steps_per_mm[E_AXIS_N]) }; + #if ENABLED(LIN_ADVANCE) + const float target_float[XYZE] = { a, b, c, e }; + #endif + + // DRYRUN prevents E moves from taking place + if (DEBUGGING(DRYRUN)) { + position[E_AXIS] = target[E_AXIS]; + #if ENABLED(LIN_ADVANCE) + position_float[E_AXIS] = e; + #endif + } + /* <-- add a slash to enable SERIAL_ECHOPAIR(" buffer_segment FR:", fr_mm_s); #if IS_KINEMATIC @@ -1484,85 +1545,48 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con SERIAL_ECHOLNPGM(")"); //*/ - // DRYRUN prevents E moves from taking place - if (DEBUGGING(DRYRUN)) { - position[E_AXIS] = target[E_AXIS]; - #if ENABLED(LIN_ADVANCE) - position_float[E_AXIS] = e; - #endif - } - - #if ENABLED(LIN_ADVANCE) - lin_dist_e = e - position_float[E_AXIS]; - #endif - - // If LIN_ADVANCE is enabled then do E move prevention with floats - // Otherwise it's done in _buffer_steps. - #if ENABLED(LIN_ADVANCE) && (ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)) - if (lin_dist_e) { - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (thermalManager.tooColdToExtrude(extruder)) { - position_float[E_AXIS] = e; // Behave as if the move really took place, but ignore E part - position[E_AXIS] = target[E_AXIS]; - lin_dist_e = 0; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); - } - #endif // PREVENT_COLD_EXTRUSION - #if ENABLED(PREVENT_LENGTHY_EXTRUDE) - if (lin_dist_e * e_factor[extruder] > (EXTRUDE_MAXLENGTH)) { - position_float[E_AXIS] = e; // Behave as if the move really took place, but ignore E part - position[E_AXIS] = target[E_AXIS]; - lin_dist_e = 0; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); - } - #endif // PREVENT_LENGTHY_EXTRUDE - } - #endif // LIN_ADVANCE && (PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE) - - #if ENABLED(LIN_ADVANCE) - if (lin_dist_e > 0) - lin_dist_xy = HYPOT(a - position_float[X_AXIS], b - position_float[Y_AXIS]); - #endif - // Always split the first move into two (if not homing or probing) if (!blocks_queued()) { #define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1 const int32_t between[ABCE] = { _BETWEEN(A), _BETWEEN(B), _BETWEEN(C), _BETWEEN(E) }; + + #if ENABLED(LIN_ADVANCE) + #define _BETWEEN_F(A) (position_float[A##_AXIS] + target_float[A##_AXIS]) * 0.5 + const float between_float[ABCE] = { _BETWEEN_F(A), _BETWEEN_F(B), _BETWEEN_F(C), _BETWEEN_F(E) }; + #endif + DISABLE_STEPPER_DRIVER_INTERRUPT(); - #if ENABLED(LIN_ADVANCE) - lin_dist_xy *= 0.5; - lin_dist_e *= 0.5; - #endif - - _buffer_steps(between, fr_mm_s, extruder, millimeters * 0.5); - - #if ENABLED(LIN_ADVANCE) - position_float[X_AXIS] = (position_float[X_AXIS] + a) * 0.5; - position_float[Y_AXIS] = (position_float[Y_AXIS] + b) * 0.5; - //position_float[Z_AXIS] = (position_float[Z_AXIS] + c) * 0.5; - position_float[E_AXIS] = (position_float[E_AXIS] + e) * 0.5; - #endif + _buffer_steps(between + #if ENABLED(LIN_ADVANCE) + , between_float + #endif + , fr_mm_s, extruder, millimeters * 0.5 + ); const uint8_t next = block_buffer_head; - _buffer_steps(target, fr_mm_s, extruder, millimeters * 0.5); + + _buffer_steps(target + #if ENABLED(LIN_ADVANCE) + , target_float + #endif + , fr_mm_s, extruder, millimeters * 0.5 + ); + SBI(block_buffer[next].flag, BLOCK_BIT_CONTINUED); ENABLE_STEPPER_DRIVER_INTERRUPT(); } else - _buffer_steps(target, fr_mm_s, extruder, millimeters); + _buffer_steps(target + #if ENABLED(LIN_ADVANCE) + , target_float + #endif + , fr_mm_s, extruder, millimeters + ); stepper.wake_up(); - #if ENABLED(LIN_ADVANCE) - position_float[X_AXIS] = a; - position_float[Y_AXIS] = b; - //position_float[Z_AXIS] = c; - position_float[E_AXIS] = e; - #endif } // buffer_segment() /** @@ -1586,7 +1610,7 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c #if ENABLED(LIN_ADVANCE) position_float[X_AXIS] = a; position_float[Y_AXIS] = b; - //position_float[Z_AXIS] = c; + position_float[Z_AXIS] = c; position_float[E_AXIS] = e; #endif stepper.set_position(na, nb, nc, ne); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index e1f3d988d1..1428168ed1 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -103,7 +103,10 @@ typedef struct { // Advance extrusion #if ENABLED(LIN_ADVANCE) bool use_advance_lead; - uint32_t abs_adv_steps_multiplier8; // Factorised by 2^8 to avoid float + uint16_t advance_speed, // Timer value for extruder speed offset + max_adv_steps, // max. advance steps to get cruising speed pressure (not always nominal_speed!) + final_adv_steps; // advance steps due to exit speed + float e_D_ratio; #endif // Fields used by the motion planner to manage acceleration @@ -195,9 +198,8 @@ class Planner { #endif #if ENABLED(LIN_ADVANCE) - static float extruder_advance_k, advance_ed_ratio, - position_float[XYZE], - lin_dist_xy, lin_dist_e; + static float extruder_advance_K, + position_float[XYZE]; #endif #if ENABLED(SKEW_CORRECTION) @@ -418,7 +420,12 @@ class Planner { * extruder - target extruder * millimeters - the length of the movement, if known */ - static void _buffer_steps(const int32_t (&target)[XYZE], float fr_mm_s, const uint8_t extruder, const float &millimeters = 0.0); + static void _buffer_steps(const int32_t (&target)[XYZE] + #if ENABLED(LIN_ADVANCE) + , const float (&target_float)[XYZE] + #endif + , float fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 + ); /** * Planner::buffer_segment @@ -432,7 +439,7 @@ class Planner { * extruder - target extruder * millimeters - the length of the movement, if known */ - static void buffer_segment(const float &a, const float &b, const float &c, const float &e, const float &fr_mm_s, const uint8_t extruder, const float &millimeters = 0.0); + static void buffer_segment(const float &a, const float &b, const float &c, const float &e, const float &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0); static void _set_position_mm(const float &a, const float &b, const float &c, const float &e); diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index d829858774..9e7afe2c47 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -111,31 +111,21 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even #if ENABLED(LIN_ADVANCE) + uint32_t Stepper::LA_decelerate_after; + constexpr hal_timer_t ADV_NEVER = HAL_TIMER_TYPE_MAX; hal_timer_t Stepper::nextMainISR = 0, Stepper::nextAdvanceISR = ADV_NEVER, Stepper::eISR_Rate = ADV_NEVER; + uint16_t Stepper::current_adv_steps = 0, + Stepper::final_adv_steps, + Stepper::max_adv_steps; - volatile int Stepper::e_steps[E_STEPPERS]; - int Stepper::final_estep_rate, - Stepper::current_estep_rate[E_STEPPERS], - Stepper::current_adv_steps[E_STEPPERS]; + int8_t Stepper::e_steps = 0, + Stepper::LA_active_extruder; // Copy from current executed block. Needed because current_block is set to NULL "too early". - /** - * See https://github.com/MarlinFirmware/Marlin/issues/5699#issuecomment-309264382 - * - * This fix isn't perfect and may lose steps - but better than locking up completely - * in future the planner should slow down if advance stepping rate would be too high - */ - FORCE_INLINE hal_timer_t adv_rate(const int steps, const hal_timer_t timer, const uint8_t loops) { - if (steps) { - const hal_timer_t rate = (timer * loops) / abs(steps); - //return constrain(rate, 1, ADV_NEVER - 1) - return rate ? rate : 1; - } - return ADV_NEVER; - } + bool Stepper::use_advance_lead; #endif // LIN_ADVANCE @@ -461,7 +451,7 @@ void Stepper::isr() { #if DISABLED(MIXING_EXTRUDER) // Don't step E here for mixing extruder count_position[E_AXIS] += count_direction[E_AXIS]; - motor_direction(E_AXIS) ? --e_steps[TOOL_E_INDEX] : ++e_steps[TOOL_E_INDEX]; + motor_direction(E_AXIS) ? --e_steps : ++e_steps; #endif } @@ -640,25 +630,6 @@ void Stepper::isr() { } // steps_loop - #if ENABLED(LIN_ADVANCE) - - if (current_block->use_advance_lead) { - const int delta_adv_steps = current_estep_rate[TOOL_E_INDEX] - current_adv_steps[TOOL_E_INDEX]; - current_adv_steps[TOOL_E_INDEX] += delta_adv_steps; - #if ENABLED(MIXING_EXTRUDER) - // Mixing extruders apply advance lead proportionally - MIXING_STEPPERS_LOOP(j) - e_steps[j] += delta_adv_steps * current_block->step_event_count / current_block->mix_event_count[j]; - #else - // For most extruders, advance the single E stepper - e_steps[TOOL_E_INDEX] += delta_adv_steps; - #endif - } - // If we have esteps to execute, fire the next advance_isr "now" - if (e_steps[TOOL_E_INDEX]) nextAdvanceISR = 0; - - #endif // LIN_ADVANCE - // Calculate new timer value if (step_events_completed <= (uint32_t)current_block->accelerate_until) { @@ -683,14 +654,15 @@ void Stepper::isr() { #if ENABLED(LIN_ADVANCE) if (current_block->use_advance_lead) { - #if ENABLED(MIXING_EXTRUDER) - MIXING_STEPPERS_LOOP(j) - current_estep_rate[j] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 17; - #else - current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17; - #endif + if (step_events_completed == step_loops || (e_steps && eISR_Rate != current_block->advance_speed)) { + nextAdvanceISR = 0; // Wake up eISR on first acceleration loop and fire ISR if final adv_rate is reached + eISR_Rate = current_block->advance_speed; + } + } + else { + eISR_Rate = ADV_NEVER; + if (e_steps) nextAdvanceISR = 0; } - eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], interval, step_loops); #endif // LIN_ADVANCE } @@ -719,14 +691,15 @@ void Stepper::isr() { #if ENABLED(LIN_ADVANCE) if (current_block->use_advance_lead) { - #if ENABLED(MIXING_EXTRUDER) - MIXING_STEPPERS_LOOP(j) - current_estep_rate[j] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 17; - #else - current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17; - #endif + if (step_events_completed <= (uint32_t)current_block->decelerate_after + step_loops || (e_steps && eISR_Rate != current_block->advance_speed)) { + nextAdvanceISR = 0; // Wake up eISR on first deceleration loop + eISR_Rate = current_block->advance_speed; + } + } + else { + eISR_Rate = ADV_NEVER; + if (e_steps) nextAdvanceISR = 0; } - eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], interval, step_loops); #endif // LIN_ADVANCE } @@ -734,10 +707,8 @@ void Stepper::isr() { #if ENABLED(LIN_ADVANCE) - if (current_block->use_advance_lead) - current_estep_rate[TOOL_E_INDEX] = final_estep_rate; - - eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], OCR1A_nominal, step_loops_nominal); + // If we have esteps to execute, fire the next advance_isr "now" + if (e_steps && eISR_Rate != current_block->advance_speed) nextAdvanceISR = 0; #endif @@ -781,55 +752,79 @@ void Stepper::isr() { #if ENABLED(MK2_MULTIPLEXER) // Even-numbered steppers are reversed #define SET_E_STEP_DIR(INDEX) \ - if (e_steps[INDEX]) E## INDEX ##_DIR_WRITE(e_steps[INDEX] < 0 ? !INVERT_E## INDEX ##_DIR ^ TEST(INDEX, 0) : INVERT_E## INDEX ##_DIR ^ TEST(INDEX, 0)) + if (e_steps) E## INDEX ##_DIR_WRITE(e_steps < 0 ? !INVERT_E## INDEX ##_DIR ^ TEST(INDEX, 0) : INVERT_E## INDEX ##_DIR ^ TEST(INDEX, 0)) #else #define SET_E_STEP_DIR(INDEX) \ - if (e_steps[INDEX]) E## INDEX ##_DIR_WRITE(e_steps[INDEX] < 0 ? INVERT_E## INDEX ##_DIR : !INVERT_E## INDEX ##_DIR) + if (e_steps) E## INDEX ##_DIR_WRITE(e_steps < 0 ? INVERT_E## INDEX ##_DIR : !INVERT_E## INDEX ##_DIR) #endif #define START_E_PULSE(INDEX) \ - if (e_steps[INDEX]) E## INDEX ##_STEP_WRITE(!INVERT_E_STEP_PIN) + if (e_steps) E## INDEX ##_STEP_WRITE(!INVERT_E_STEP_PIN) #define STOP_E_PULSE(INDEX) \ - if (e_steps[INDEX]) { \ - e_steps[INDEX] < 0 ? ++e_steps[INDEX] : --e_steps[INDEX]; \ + if (e_steps) { \ + e_steps < 0 ? ++e_steps : --e_steps; \ E## INDEX ##_STEP_WRITE(INVERT_E_STEP_PIN); \ } - SET_E_STEP_DIR(0); - #if E_STEPPERS > 1 - SET_E_STEP_DIR(1); - #if E_STEPPERS > 2 - SET_E_STEP_DIR(2); - #if E_STEPPERS > 3 - SET_E_STEP_DIR(3); - #if E_STEPPERS > 4 - SET_E_STEP_DIR(4); - #endif - #endif - #endif - #endif + if (current_block->use_advance_lead) { + if (step_events_completed > LA_decelerate_after && current_adv_steps > final_adv_steps) { + e_steps--; + current_adv_steps--; + nextAdvanceISR = eISR_Rate; + } + else if (step_events_completed < LA_decelerate_after && current_adv_steps < max_adv_steps) { + //step_events_completed <= (uint32_t)current_block->accelerate_until) { + e_steps++; + current_adv_steps++; + nextAdvanceISR = eISR_Rate; + } + else { + nextAdvanceISR = ADV_NEVER; + eISR_Rate = ADV_NEVER; + } + } + else + nextAdvanceISR = ADV_NEVER; - // Step all E steppers that have steps - for (uint8_t i = step_loops; i--;) { + switch(LA_active_extruder) { + case 0: SET_E_STEP_DIR(0); break; + #if EXTRUDERS > 1 + case 1: SET_E_STEP_DIR(1); break; + #if EXTRUDERS > 2 + case 2: SET_E_STEP_DIR(2); break; + #if EXTRUDERS > 3 + case 3: SET_E_STEP_DIR(3); break; + #if EXTRUDERS > 4 + case 4: SET_E_STEP_DIR(4); break; + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + } + + // Step E stepper if we have steps + while (e_steps) { #if EXTRA_CYCLES_E > 20 hal_timer_t pulse_start = HAL_timer_get_count(PULSE_TIMER_NUM); #endif - START_E_PULSE(0); - #if E_STEPPERS > 1 - START_E_PULSE(1); - #if E_STEPPERS > 2 - START_E_PULSE(2); - #if E_STEPPERS > 3 - START_E_PULSE(3); - #if E_STEPPERS > 4 - START_E_PULSE(4); - #endif - #endif - #endif - #endif + switch(LA_active_extruder) { + case 0: START_E_PULSE(0); break; + #if EXTRUDERS > 1 + case 1: START_E_PULSE(1); break; + #if EXTRUDERS > 2 + case 2: START_E_PULSE(2); break; + #if EXTRUDERS > 3 + case 3: START_E_PULSE(3); break; + #if EXTRUDERS > 4 + case 4: START_E_PULSE(4); break; + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + } // For minimum pulse time wait before stopping pulses #if EXTRA_CYCLES_E > 20 @@ -839,19 +834,21 @@ void Stepper::isr() { DELAY_NOPS(EXTRA_CYCLES_E); #endif - STOP_E_PULSE(0); - #if E_STEPPERS > 1 - STOP_E_PULSE(1); - #if E_STEPPERS > 2 - STOP_E_PULSE(2); - #if E_STEPPERS > 3 - STOP_E_PULSE(3); - #if E_STEPPERS > 4 - STOP_E_PULSE(4); - #endif - #endif - #endif - #endif + switch(LA_active_extruder) { + case 0: STOP_E_PULSE(0); break; + #if EXTRUDERS > 1 + case 1: STOP_E_PULSE(1); break; + #if EXTRUDERS > 2 + case 2: STOP_E_PULSE(2); break; + #if EXTRUDERS > 3 + case 3: STOP_E_PULSE(3); break; + #if EXTRUDERS > 4 + case 4: STOP_E_PULSE(4); break; + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + } // For minimum pulse time wait before looping #if EXTRA_CYCLES_E > 20 @@ -1116,11 +1113,6 @@ void Stepper::init() { ENABLE_STEPPER_DRIVER_INTERRUPT(); - #if ENABLED(LIN_ADVANCE) - for (uint8_t i = 0; i < COUNT(e_steps); i++) e_steps[i] = 0; - ZERO(current_adv_steps); - #endif - endstops.enable(true); // Start with endstops active. After homing they can be disabled sei(); diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 0a051d6153..e976c3692d 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -98,18 +98,20 @@ class Stepper { static volatile uint32_t step_events_completed; // The number of step events executed in the current block #if ENABLED(LIN_ADVANCE) - static hal_timer_t nextMainISR, nextAdvanceISR, eISR_Rate; - #define _NEXT_ISR(T) nextMainISR = T - static volatile int e_steps[E_STEPPERS]; - static int final_estep_rate; - static int current_estep_rate[E_STEPPERS]; // Actual extruder speed [steps/s] - static int current_adv_steps[E_STEPPERS]; // The amount of current added esteps due to advance. - // i.e., the current amount of pressure applied - // to the spring (=filament). - #else + static uint32_t LA_decelerate_after; // Copy from current executed block. Needed because current_block is set to NULL "too early". + static hal_timer_t nextMainISR, nextAdvanceISR, eISR_Rate; + static uint16_t current_adv_steps, final_adv_steps, max_adv_steps; // Copy from current executed block. Needed because current_block is set to NULL "too early". + #define _NEXT_ISR(T) nextMainISR = T + static int8_t e_steps; + static int8_t LA_active_extruder; // Copy from current executed block. Needed because current_block is set to NULL "too early". + static bool use_advance_lead; + + #else // !LIN_ADVANCE + #define _NEXT_ISR(T) HAL_timer_set_compare(STEP_TIMER_NUM, T); - #endif // LIN_ADVANCE + + #endif // !LIN_ADVANCE static long acceleration_time, deceleration_time; static uint8_t step_loops, step_loops_nominal; @@ -239,13 +241,11 @@ class Stepper { FORCE_INLINE static void set_x_lock(const bool state) { locked_x_motor = state; } FORCE_INLINE static void set_x2_lock(const bool state) { locked_x2_motor = state; } #endif - #if ENABLED(Y_DUAL_ENDSTOPS) FORCE_INLINE static void set_homing_flag_y(const bool state) { performing_homing = state; } FORCE_INLINE static void set_y_lock(const bool state) { locked_y_motor = state; } FORCE_INLINE static void set_y2_lock(const bool state) { locked_y2_motor = state; } #endif - #if ENABLED(Z_DUAL_ENDSTOPS) FORCE_INLINE static void set_homing_flag_z(const bool state) { performing_homing = state; } FORCE_INLINE static void set_z_lock(const bool state) { locked_z_motor = state; } @@ -351,6 +351,22 @@ class Stepper { static int8_t last_extruder = -1; + #if ENABLED(LIN_ADVANCE) + if (current_block->active_extruder != last_extruder) { + current_adv_steps = 0; // If the now active extruder wasn't in use during the last move, its pressure is most likely gone. + LA_active_extruder = current_block->active_extruder; + } + + if (current_block->use_advance_lead) { + LA_decelerate_after = current_block->decelerate_after; + final_adv_steps = current_block->final_adv_steps; + max_adv_steps = current_block->max_adv_steps; + use_advance_lead = true; + } + else + use_advance_lead = false; + #endif + if (current_block->direction_bits != last_direction_bits || current_block->active_extruder != last_extruder) { last_direction_bits = current_block->direction_bits; last_extruder = current_block->active_extruder; @@ -366,22 +382,6 @@ class Stepper { acceleration_time = calc_timer_interval(acc_step_rate); _NEXT_ISR(acceleration_time); - #if ENABLED(LIN_ADVANCE) - if (current_block->use_advance_lead) { - current_estep_rate[current_block->active_extruder] = ((unsigned long)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17; - final_estep_rate = (current_block->nominal_rate * current_block->abs_adv_steps_multiplier8) >> 17; - } - #endif - - // SERIAL_ECHO_START(); - // SERIAL_ECHOPGM("advance :"); - // SERIAL_ECHO(current_block->advance/256.0); - // SERIAL_ECHOPGM("advance rate :"); - // SERIAL_ECHO(current_block->advance_rate/256.0); - // SERIAL_ECHOPGM("initial advance :"); - // SERIAL_ECHO(current_block->initial_advance/256.0); - // SERIAL_ECHOPGM("final advance :"); - // SERIAL_ECHOLN(current_block->final_advance/256.0); } #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM