Pressure advance Tuning like Klipper
-
A slight addition to this is how to include the starting pressure advance.
Once you have used the original 'after layer change' code to get a rough idea of where the sweet spot is you can use the gcode below.
For my printer the sweet spot was about 0.5. So I printed again, starting at 0.4 and up to 0.65
M572 D0 S{(layer_z*0.005)+0.4}
-
Do both Lines come into the Slicer in the Custom GCode before Layer Change?
-
only the M572, the M201 you can execute before print starts manually
-
@Veti said in Pressure advance Tuning like Klipper:
M572 D0 S{layer_z*0.005}
Is there a way to have an expression that will set it up in 'bands' rather than gradual on every layer? May be easier to determine the best value.
-
@zapta said in Pressure advance Tuning like Klipper:
@Veti said in Pressure advance Tuning like Klipper:
M572 D0 S{layer_z*0.005}
Is there a way to have an expression that will set it up in 'bands' rather than gradual on every layer? May be easier to determine the best value.
You could use somethingIf mod(layer_z,5)==0 M572 D0 S{layer_z*0.005}
This would only increment every 5 layers.
Note this is untested and Prusa slicer can get funny about if statements in its gcode sections as it trys to evaluate them itself using its own rules
You may have to wrap the whole expression in curly brackets or somethingEDIT: actually I think I recall prusa slicer won't allow indenting in the layer gcode so this may not work
EDIT
A quick search revealed something like this should work in prusa slicer... again untested{if layer_z % 5 == 0}M572 D0 S{layer_z*0.005}{endif}
-
@OwenD said in Pressure advance Tuning like Klipper:
{if layer_z % 5 == 0}M572 D0 S{layer_z*0.005}{endif}
Mathematically this seems right. You may want to multiply 0,005 by 5 to have the same range (5 layers per band). Bands make it easier to identify the best value.
May be worth replacing the gcode in https://duet3d.dozuki.com/Wiki/Pressure_advance with a simplified one along these lines.
-
actually mod() won't work as layer_z is a floating point number.
It would work with layer_num but that makes determining the value used at a specific height different to the example. -
In RRF, metacommand function
mod
works with floats, so useif mod(floor(move.axes.2.machinePosition), 5.0)
maybe? Untested. -
if you actually print with the gradual change, its a lot easier to determine where the optimal line is as its a gradual change. and using the calipers gives you an easy way to calculate the right value.
-
@Veti
Create a macro and call it at layer change. Much easier to update the macro instead of slicing the file for every change.
You can call macros from the macro folder using the full file location similar toM98 P"0:/macros/Calibrate Things"
Put something similar to this in the macro. Again this particular code is untested.
If mod(layer_z,5)==0 M572 D0 S{layer_z*0.005} echo {move.axes[2].userPosition} ; change 2 in axes[2] to the z axis for your machine echo {layer_z*0.005}
This will report the the z height and the PA value every time it changes.
-
Adding to what @3dML said...
This macro has been tested and works nicely, change tool no./layer height/increment value to suit. It also covers the case where you want to start from a value other than 0, simply change the first M572 parameter.
;Increase pressure advance by 0.005 every 5 layers if job.layer == 0 M572 D0 S0 ; starting value echo "Layer " ^ job.layer ^ " started" echo "Pressure advance reset to " ^ {move.extruders[0].pressureAdvance + 0.000} elif mod(job.layer, 5) == 0 ; no. of layers M572 D0 S{move.extruders[0].pressureAdvance + 0.005} ; increment echo "Layer " ^ job.layer ^ " started" echo "Pressure advance = " ^ {move.extruders[0].pressureAdvance + 0.000}
Interestingly the "+ 0.000" is required to force the console to print 3 decimal places, otherwise it rounds down to 2.
-
small update for the macro the first layer is not == 0 rather == nullit seems thatthe prusaslicer execute the macro first on the 1 layer so the pa value will never resets to 0;Increase pressure advance by 0.005 every 5 layers if job.layer == 1 M572 D0 S0 ; starting value echo "Layer " ^ job.layer ^ " started" echo "Pressure advance reset to " ^ {move.extruders[0].pressureAdvance + 0.000} elif mod(job.layer, 5) == 0 ; no. of layers M572 D0 S{move.extruders[0].pressureAdvance + 0.020} ; increment echo "Layer " ^ job.layer ^ " started" echo "Pressure advance = " ^ {move.extruders[0].pressureAdvance + 0.000}
-
@littlehobbyshop said in Pressure advance Tuning like Klipper:
Interestingly the "+ 0.000" is required to force the console to print 3 decimal places, otherwise it rounds down to 2.
That's because each object model value has its own default number of decimal places, which for pressure advance is 2. If you can show that a difference of less than 0.01 in pressure advance has a measurable effect, I will increase that to 3.