Correct way to adjust nozzle temp from custom G-Code

Hi there.

I’m using a P1S with Bambu Slicer 1.10.2.76. My P1S is on firmware 01.07.00.00

At layer 1117 of 1284 in my print I am attempting to reduce the nozzle temperature by 5 degrees.

I added the following custom g-code:
M104 S{nozzle_temperature[current_extruder]-5}

I expected that I would see a drop from 220->215 but instead it looks like the instruction was ignored.

Did I format it incorrectly? Should I have used a different variable?

NOTE: I’d like this to be relative so I could use other filaments that may require slightly different temperatures when printing my model.

Thanks for any help you can provide!

-Greg

Someone can correct me, but I don’t think the “insert g-code” supports the macro language. Just try M104 S195. Works for me according to the temperature preview.

1 Like

Correct, you need to input the actual temperature you want, not the amount you want to add or subtract.

In the OPs case it would be:
M104 S215

1 Like

G-code does not have macros like you are trying to use, you need studio to pre-process them but you are inserting them too late into the g-code rendering pipeline. (again, just assuming from my tests both ways)

1 Like

Thanks all. So I guess my alternative is that I could add layer change logic (and key off a specific layer) in custom printer gcode. I may try that approach.

1 Like

Be mindful that Bambu Labs may be using custom g-code as a way of protecting their IP from being copied.
I have seen more than one instance of someone throwing their printer into a tailspin trying to modify g-code in P Series printers and probably the same has happened with the other models

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.