custom g-code: add 10° to temperature
Hello! i'm working on a temp tower and can't figure out how to increase temperature with custom g-code. Can you help me?
If i want to set a temp value (waiting extruder temp before proceeding) i should use 109, it's correct?
so: M109 S215
but if i want to add 10° to the start temperature is there any code? (in this case the tower will work with every default temperature set)
Thank you in advance for any help
RE: custom g-code: add 10° to temperature
Well the start gcode uses placeholders rather than specific values. These placeholders temperatures are taken from the values of the filament you have selected.
M109 S[first_layer_temperature] ; wait for extruder temp
So you could use the placeholder inside an expression to modify it by different amounts. For example M109 S{(first_layer_temperature[0])+ (10)} ; wait for extruder temp - would set the temp to whatever the filament is configured for +10 degrees. You can have a series of those that change it at different points.
For a normal temp tower the change needed is tied to height of the model you are using. As such the usual 'easy' way is just to insert some custom gcode using the slider when sliced and insert gcode at the appropriate layers. Same method as inserting a colour change or pause but with custom gcode.
If you have a specific model then there are several existing threads that show examples of how to do something ties to layers mathematically. For example this thread https://forum.prusa3d.com/forum/prusaslicer/how-to-set-up-a-temperature-tower/
RE: custom g-code: add 10° to temperature
@neophyl
many thanks for the info. Assuming i'm starting at 215°. when i insert custom code at specific layer height, will it work if I use:
M109 S{+ (10)}; wait for extruder temp
RE: custom g-code: add 10° to temperature
No it wont. You cant just use a +10. While its simple code, its still code. +10 to what ? You can either use a Specific temperature "M109 S250" for example at each layer where you want a different temperature or you have to use the full gcode M109 S{(first_layer_temperature[0])+ (10)} then S{(first_layer_temperature[0])+ (20)} if you wanted filament temp +10 at one layer and filament temp +20 at the next.
If you generate the gcode and look through it you will see those lines actually are replaced with a normal M109 Sxxx value when output. The printer is dumb as a bag of rocks, these are all generated and worked out at slicing time.
RE: custom g-code: add 10° to temperature
@neophyl
thanks for your patience 🙂 just trying to figure out the easiest way. I thought that when you start a print a temperature is already set based on your filament (es: 215°) and then it would be possible to add a specific value (+10=225°). But... forget about 🙂
RE: custom g-code: add 10° to temperature
Doesnt matter what temperature you set on the printer initially, what filament etc except for running built in operations from the printer itself (ie from the lcd) for things like loading or preheating. For those it uses values built in to the printer firmware (or what you set on the controls). As soon as it starts running a gcode file it will just blindly follow whats in that file. So if the gcode says to go to temperature 280 it will attempt to do so. If you have pla in then it doesnt care that it will cook it.
When you start a print the temperature is set based on your filament, but only because Prusa standard start gcode (located in Printer Settings>Custom Gcode>Start will contain the M109 S[first_layer_temperature] command. The placeholder fills in the temp from the filament profile when you click Slice.