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.72k stars 1.93k forks source link

Start G-code containing temperature comand overwrites first layer temperature #8911

Closed tjhalva closed 2 years ago

tjhalva commented 2 years ago

Description of the bug

If the Start G-code setting is modified to include a temperature command like M109 the generated gcode ignores the first layer temperature.

I would expect the Start G-code to be blindly inserted without having logic to remove the first layer temperature settings.

I'm attempting to add priming steps to the extruder at the start and want to raise the hotend temperature so that a couple cm of filament can be pushed through the hotend.

Project file & How to reproduce

If the first layer temperature is set to 210, and I'm using the default Start G-code value of:

G28 ; home all axes
G1 Z5 F5000 ; lift nozzle

When the g-code is generated this is the generated preamble:

M107
M190 S65 ; set bed temperature and wait for it to be reached
M104 S210 ; set temperature
;TYPE:Custom
G28 ; home all axes
G1 Z5 F5000 ; lift nozzle
M109 S210 ; set temperature and wait for it to be reached
G21 ; set units to millimeters
G90 ; use absolute coordinates
M82 ; use absolute distances for extrusion
G92 E0
; Filament gcode
M107
;LAYER_CHANGE
...

Notice there is an M104 and an M109 command setting the temperature to 210.

If I modify the Start G-code stanza to contain a temperature command, such as M104 S190, it looks like this:

G28 ; home all axes
G1 Z5 F5000 ; lift nozzle
M104 S190 ;

Notice the M109 command is removed, and there is no longer an M109 S210 to set the first layer temperature.

M107
M190 S65 ; set bed temperature and wait for it to be reached
;TYPE:Custom
G28 ; home all axes
G1 Z5 F5000 ; lift nozzle
M109 S190 ; set temperature and wait for it to be reached
G21 ; set units to millimeters
G90 ; use absolute coordinates
M82 ; use absolute distances for extrusion
G92 E0
; Filament gcode
M107
;LAYER_CHANGE
...

The value of the first layer temperature is lost and never applied. It also looks like the change from the first layer to the second and subsequent layers is lost as well, but I haven't deeply verified that.

Checklist of files included above

Version of PrusaSlicer

2.5.0-win64

Operating system

Windows 7

Printer model

NA

neophyl commented 2 years ago

Yes that is the way its supposed to work. It is designed that way. If you don't include initial temperature commands then PS will automatically add them for you. If you specify your own then this automatic behavior is bypassed as you have explicitly set what you want.

There are issues on here where people have complained about the fact that it does automatically add them in, so the devs cant win. P=Users who dont want them added (for example those using a klipper macro) will set them right at the start to all be zero, this stops them being added and they can use their macro without interference then.

Btw the usual way to specify the starting temps is to use the correct placeholders in your start gcode block. By adding them in known positions you stop PS from adding any extra automatic ones in unwanted places and the settings from the filaments are automatically used. For example M140 S[first_layer_bed_temperature] ; set bed final temp M104 S[first_layer_temperature] ; set extruder final temp M109 S[first_layer_temperature] ; wait for extruder final temp M190 S[first_layer_bed_temperature] ; wait for bed final temp

rtyr commented 2 years ago

Intended behavior, it is also mentioned in the tooltip. Thanks Neophyl.