prusa3d / PrusaSlicer

G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
https://www.prusa3d.com/prusaslicer/
GNU Affero General Public License v3.0
7.69k stars 1.93k forks source link

Pressure Equalizer causes relative moves from Custom GCODE to be copied to Main GCODE #11536

Open echo-lalia opened 11 months ago

echo-lalia commented 11 months ago

Description of the bug

TLDR:

I have a custom color change GCODE that utilizes relative positioning to move the Z axis up 30mm, then down 30mm(then sets back to absolute positioning). When the pressure equalizer settings are enabled, it causes G1 Z-30 moves to be inserted unpredictably/repeatedly on the regular extruding GCODE.

More:

I set up a custom color changing GCODE to help with several simple two color prints I needed to do. PrusaSlicer does not support the "layer_z" or other similar variables in the color change GCODE, so I had to just use relative positioning to get the job done. Here is what I wrote:

G91 ; relative positioning
M83 ; extruder relative mode
G92 E0 ;Reset Extruder

G1 E-2 F6000 ; quick retract
G1 Z30 F1000 ; move up
G1 E-100 F300 ; unload

M300 P100 S3000 ; play tone
G4 P500 ; Dwell for 1/2 second
M300 P400 S4000

M0 Click After Loading New Filament
G4 P500 ; Dwell for 1/2 second

G1 E100 F300 ; load filament
G1 E20 F100 ; attempt to purge

M0 Click After Cleaning
G4 P500 ; Dwell for 1/2 second

G1 E-2 F6000 ; quick retract
G1 Z-30 F1000 ; move back down
G1 E2 F6000 ; quick unretract
G1 F300

G90 ; absolute positioning
M83 ; extruder relative mode
G92 E0 ; Reset Extruder

(I have already tested removing everything but the G1 moves and the G90/91 moves, and it gives the same result)

The custom gcode worked fine yesterday, but today it was giving problems, I went through my print profiles to try isolating the issue, and it seems that it only happens when "Max volumetric slope positive/negative" are set to a non-zero value.

Project file & How to reproduce

problem.zip image (notice that the nozzle plummets after the color change in the screenshot)

Checklist of files included above

Version of PrusaSlicer

Version 2.6.1+win64

Operating system

WIndows 10

Printer model

Modified Ender 2 Pro (octoprint/marlin2)

rtyr commented 11 months ago

I set up a custom color changing GCODE to help with several simple two color prints I needed to do.

This is quite strange way how to perform a color change. Color change should be handled by the firmware, not by such custom g-code. So the correct way is to configure the firmware and then just use command for color change (typically M600).

happens when "Max volumetric slope positive/negative" are set to a non-zero value.

I can see that moves generated by pressure equalizer also contains Z coordinates. It seems it uses the last used Z coordinates, which is Z-30 in your case. That last travel in your custom g-code was performed still in the relative mode, but PrusaSlicer does not support/expect relative addressing in general (it is not possible to generate g-code with relative positioning, apart from relative extrusion positioning). The question is, whether we need to emit Z coordinates for equalized moves. FYI @hejllukas