Gcode to enable restoring print nozzle temps

Hi All, Im trying to improve my filament change macro by capturing the Extruder Temp and then restoring that temp once the new filament has been loaded. To aid my understanding, I wrote a very basic test macro to see if it was possible.

However, it doesn’t work - any ideas as to what I’m missing / misunderstanding?

[gcode_macro TEST]
gcode:
    M109 S200
    {% set TARGET_TEMP = printer.extruder.target|int  %}  # store extruder temp setpoint
    M109 S150 # change extruder temp
	#----------
    M109 S{TARGET_TEMP}            # Return the extruder temp to previous printing temp

In the first place, reading the instructions when opening this post, otherwise you would not have posted in Developers.

Further refer to Help with Macro: SET_GCODE_VARIABLE doesnt set my variable - #10 by theophile and following

I did and it seemed like general coding discussion was allowed. The macro topic is for completed macros afaik.

What exactly makes an error in your macro a Klipper “code related developer topic”?
Latest the “not intended for support or bug reporting” should have finally made it clear.

1 Like

I was seeking to understand how to write macro code correctly. Code is code in my book, macro or otherwise.

I was not asking for general Klipper support.

Please drop the snark, it’s unhelpful.

Listen, you come here seeking for support that is granted for free by knowledgeable people.
Out of sheer politeness and respect, it is expected that in this case you will also abide by the rules that have been established.
To interpret them as it suits you, maybe also with the idea to get faster support here, because you do not post in the boring “General” category, but importantly under “Developer”, certainly does not fulfill that.

2 Likes

You were plain rude to start with, i was asking for help understanding how to store and retrieve variables, hardly unrelated to “development”.

I used a very simple macro as an example of the concept i was trying to understand and test. Hardly an unreasonable way to approach a problem.

I have found help elsewhere, no thanks to you.

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