-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
Smooth Linear Advance with extruder synchronisation #27710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smooth Linear Advance with extruder synchronisation #27710
Conversation
(cherry picked from commit 29720dc)
(cherry picked from commit 28300f8)
First thought: what about a name change at this point? "Linear advance" isn't as good name as "pressure advance" and everyone knows "smooth pressure advance" from Klipper, so just the name would communicate a lot if we changed "linear" to "pressure". @thinkyhead |
(cherry picked from commit 3722520)
Hi, @dbuezas I tried to calibrate extruder steps per mm, extruding specific filament length without nozzle and found, that SMOOTH_LIN_ADVANCE introduces some extrusion length error, depending on extrusion speed, it could several percents, e.g. 5%. I also use S_CURVE. Anyway, should be condition ANY_AXIS_MOVES(current_block) checked for all this mechanism to prevent interaction with rectract/unretract? |
Something like this:
|
Smooth linear advance could still be applying corrections after the other axes stopped, the smoothing makes it start accelerating tau seconds before planned, and stop (roughly) tau seconds after. This is by design to avoid discontinuities is rate. Also set_la_interval actually covers all extrusion, not only the linear advance part. Regarding the error you observe, it may be numerical error since it works on rates and not positions, but 5% is too high to be explained by that. Do you also get that kind of variance with NLE disabled? |
Yes. First, NLE is applied only if axes are moving ( Also I set LA to zero, also didn't change a thing. Could high extrusion speed (w/o the nozzle, 20-30 mm/sec, 50-77mm^3) be related to this? |
Mmm maybe, hard to say. A very low tau would make it act like the old LA |
Even with zero LA? |
Oh good point, with zero LA it should be the same thing as not having anything. |
Should it apply correction when extrusion speed is constant? |
A slight drift may happen since pulses aren't counted. smoothLA just assumes distance traveled from previous time and rate. I don't expect the drift to be so large though, so this may not be the reason of what you are measuring. You are sure this error is not present without smooth LA, right? |
Well, I build with following config without NLE:
Here is underextrusion table for speed (mm/s):
Here is a graph: No LA/Tau change affect this. As I mention I have fast 500MHz SKR-3 board. |
Can you add a trace without smooth LA? |
Just enable LA_DEBUG? |
I mean without |
Do you mean COM-port dump? How to enable needed tracing? |
I just mean a trace in the plot, an extra curve |
Ahh, I checked it - without SMOOTH_LIN_ADVANCE it's always the same correct length. |
Ok that's super weird. With so much under extrusion it would really show |
In most speed range it's about 3%-5%, not too much to be seen by eyes.
|
But quite noticeable onTm top surfaces |
It depends on the speed so. Check it in your printer, it's very simple check.
|
Maybe it would then be best to either track actual steps done, or to leave the non LA term be handled directly by the block interrupt as before |
Sorry?
Use smoothing only for acceleration/deceleration phase? |
Currently it calculated rates and uses them, but it doesn't count the steps done for the motor, it just "assumes" them through velocity * time
That won't work, smoothing discontinuities involves starting earlier to be able to ramp up the speed incrementally and the same on at the end of that phase. Linear advance demands to start a block with the extruder jumping from 0 to accel*k instantly, smooth LA ramps up instead. This ramp up means error, and the error is spread in time by starting earlier. During most of the cruise phase, the extruder should go at the exact same speed than it used to, except for maybe some rounding error. |
v034 - "The refactor update" - included all Marlin upstream commits till 29.06.2025 - Smooth Linear Advance enabled with a default TAU of 0.020 in mainboard and screen firmware. read more about Smooth Linear Advance here: MarlinFirmware#27710 - introduced DYNAMIC_LEVELING and DYNAMIC_TRAMMING variables to conditionally enable or disable both on compile time - starting autoleveling ALWAYS triggers a G28 Homing, even if you just entered the autoleveling site and the printer is homed - more "changeable" text fields in blue on the screen - reverted old non working "probe error 203 on point 1" fix - rewritten both UBL and ABL to be conditionally dynamic - removed old debug functions in stable code parts (so all, haha) - rewritten the complete E3S1PRO_RTS implementation - the "probe error 203 but finish autoleveling on point 1" bug was fixed by a earlier variable update of max_points
v034 - "The refactor update" - included all Marlin upstream commits till 29.06.2025 - Smooth Linear Advance enabled with a default TAU of 0.020 in mainboard and screen firmware. read more about Smooth Linear Advance here: MarlinFirmware#27710 - introduced DYNAMIC_LEVELING and DYNAMIC_TRAMMING variables to conditionally enable or disable both on compile time - starting autoleveling ALWAYS triggers a G28 Homing, even if you just entered the autoleveling site and the printer is homed - more "changeable" text fields in blue on the screen - reverted old non working "probe error 203 on point 1" fix - rewritten both UBL and ABL to be conditionally dynamic - removed old debug functions in stable code parts (so all, haha) - rewritten the complete E3S1PRO_RTS implementation - the "probe error 203 but finish autoleveling on point 1" bug was fixed by a earlier variable update of max_points - hotfixed MarlinCore.cpp to fix cardreader timing
v034 - "The refactor update" - included all Marlin upstream commits till 29.06.2025 - Smooth Linear Advance enabled with a default TAU of 0.020 in mainboard and screen firmware. read more about Smooth Linear Advance here: MarlinFirmware#27710 - starting autoleveling ALWAYS triggers a G28 Homing, even if you just entered the autoleveling site and the printer is homed - more "changeable" text fields in blue on the screen - reverted old non working "probe error 203 on point 1" fix - removed old debug functions in stable code parts (so all, haha) - the "probe error 203 but finish autoleveling on point 1" bug was fixed by a earlier variable update of max_points
v034 - "The refactor update" - included all Marlin upstream commits till 29.06.2025 - Smooth Linear Advance enabled with a default TAU of 0.020 in mainboard and screen firmware. read more about Smooth Linear Advance here: MarlinFirmware#27710 - starting autoleveling ALWAYS triggers a G28 Homing, even if you just entered the autoleveling site and the printer is homed - more "changeable" text fields in blue on the screen - reverted old non working "probe error 203 on point 1" fix - removed old debug functions in stable code parts (so all, haha) - the "probe error 203 but finish autoleveling on point 1" bug was fixed by a earlier variable update of max_points Update stm32f1.ini
v034 - "The refactor update" - included all Marlin upstream commits till 29.06.2025 - Smooth Linear Advance enabled with a default TAU of 0.020 in mainboard and screen firmware. read more about Smooth Linear Advance here: MarlinFirmware#27710 - introduced DYNAMIC_LEVELING and DYNAMIC_TRAMMING variables to conditionally enable or disable both on compile time - starting autoleveling ALWAYS triggers a G28 Homing, even if you just entered the autoleveling site and the printer is homed - more "changeable" text fields in blue on the screen - reverted old non working "probe error 203 on point 1" fix - rewritten both UBL and ABL to be conditionally dynamic - removed old debug functions in stable code parts (so all, haha) - rewritten the complete E3S1PRO_RTS implementation - the "probe error 203 but finish autoleveling on point 1" bug was fixed by a earlier variable update of max_points
Description
Introduces a new smooth linear advance method that decouples extrusion from motion constraints, improving print speed and quality without acceleration limits. (comparable to Klipper's approach).
pressure_advance_smooth_time
and can be configured in the LCD or via GCODE. The lower the better, as long as the extruder stepper doesn't skip steps.Enabling SMOOTH_LIN_ADV results in faster and higher quality prints in 32 bit MCUs
The new ISR allows for a second second feature,
INPUT_SHAPING_E_SYNCH
, which synchronises the extruder with the input shaped x and y axes. This results in very accurate extrusion during acceleration phases. Synchronizing E to input shaping improves seams and top surfaces significantly, even at high accelerations (e.g nice seams and top surfaces at 15k mm/s^2).Requirements
32 bit MCU
Benefits
Enables higher acceleration without extrusion artifacts
Configurations
Related Issues
This is a further evolution of- and closes #27352. Now with more solid mathematical foundations and improved precision.
Misc
I have a fast 32 bit MCU with FPU so I made liberal use of floats. Further optimisations (e.g. fixed-point arithmetic, planner pre-computations) are possible. However, given the significant speed and quality improvements, I propose addressing those in a follow-up PR after merging this foundational implementation. I'm getting the speed and quality of a Voron or bambulab in my Ultimaker 2 with a direct drive extruder.
@tombrazier mentioned that, at least in theory, extrusion synchronisation could be done at step level. If implemented, it would replace my version of INPUT_SHAPING_E_SYNCH.
Validation of this approach
Analysed stepper control signals with a logic analyzer and performed extensive testing (>1kg of prints)
Thanks @oliof and @tombrazier for the early feedback and discussions in discord.