Actually, after some thoughts, I realized that it should not be that difficult to implement dynamic adjustment of pressure advance. I pushed the code to this branch @igiannakas in case you want to give it a try. This should work pretty much as mainline Klipper without any changes, just the commands SET_PRESSURE_ADVANCE ADVANCE=...
will take effect on the next gcode commands and will not flush the move queue (note that modifying smooth time via SET_PRESSURE_ADVANCE SMOOTH_TIME=...
will flush the queue, so better not do it during the printing).
Here’s an example of using it, obtained with motan tool (you can see the PA changing mid-moves without flushing the move queue except the last 2 moves where smooth_time is also changed). Edit: in case the chart is confusing, ‘extruder position’ and ‘extruder velocity’ (in blue) are the extruder stepper position and velocity after the PA is applied (so these are the true commanded positions and velocities), and ‘extruder x position’ and ‘extruder x velocity’ (in orange) are the corresponding position and velocity of the extruder from the trapezoidal move planner before any PA (or smoothing) is applied.
for the following sequence:
GCode
SET_PRESSURE_ADVANCE ADVANCE=0.1
; Home and extrusion moves
G28
G1 X20 Y20 Z10 F6000
G1 E2 F600
G1 X25 Y25 E2.5 F6000
G1 X30 Y30 E3.0
; Update pressure advance for primary extruder
SET_PRESSURE_ADVANCE ADVANCE=0.01
G1 X35 Y35 E3.5
; Update pressure advance for primary extruder
SET_PRESSURE_ADVANCE ADVANCE=0.05
G1 X40 Y40 E4.0 F3000
; Update smooth_time
SET_PRESSURE_ADVANCE SMOOTH_TIME=0.01
G1 X45 Y45 E4.5 F6000
; Updating both smooth_time and pressure advance
SET_PRESSURE_ADVANCE SMOOTH_TIME=0.03 ADVANCE=0.1
G1 X50 Y50 E5.0