Can someone fix my broke code?

Made this as a macro to warm up the printer before I print but it does not display messages correctly on Orcaslicer and it does not turn on the chamber heater even though it says the state of the heater is 90% and set to 60C. To get the heater to turn on I have to turn the printer off then on and then manually set the chamber heater to 60C via the LCD screen.

In the marcro.cfg file I put:

[gcode_macro WARMUP_ASA_CF_HEATSOAK]
description: Preheats bed, waits 1 minute, then kicks on nozzle standby and chamber
gcode:

# Set default target values if not provided

{% set BED_TEMP = params.BED|default(100)|int %}
{% set EXTRUDER_TEMP = params.EXTRUDER|default(130)|int %}
{% set CHAMBER_TEMP = params.CHAMBER|default(60)|int %}
{% set SOAK_MINUTES = params.SOAK|default(15)|int %}

M117 Warmup started…

# 1. Start heating the high-draw SV08 Max bed first
M117 Initializing Bed Heat…
M140 S{BED_TEMP} ; Target Bed immediately

# 2. Force a 1-minute delay before starting the next heating element
M117 Staggering heaters: waiting 1 minute…
G4 P60000 ; Pause for 60,000ms (1 minute)

# 3. Initialize Nozzle and Chamber after the delay
M117 Initializing Extruder Then Chamber…
M104 S{EXTRUDER_TEMP} ; Target Extruder standby
G4 P30000

{% if CHAMBER_TEMP > 0 %}
M141 S{CHAMBER_TEMP} ; Set Chamber Heater Target
{% endif %}

# 4. Home XYZ safely if not already homed
{% if “xyz” not in printer.toolhead.homed_axes %}
G28
{% endif %}

# 5. Elevate and park the toolhead to protect the Eddy probe from rising hot air
M117 Parking toolhead…
G90 ; Absolute positioning
G0 X250 Y480 Z100 F6000 ; Move to back center, away from radiation

# 6. Wait for physical targets to finish reaching limits
M117 Waiting for Bed to reach {BED_TEMP}C…
M190 S{BED_TEMP} ; Wait for Bed

{% if CHAMBER_TEMP > 0 %}
M117 Waiting for Chamber to reach {CHAMBER_TEMP}C…
M191 S{CHAMBER_TEMP} ; Wait for Chamber to hit target
{% endif %}

# 7. Supplementary heat soak timer countdown
{% if SOAK_MINUTES > 0 %}
M117 Core temps reached. Soaking for {SOAK_MINUTES} min…
{% for i in range(SOAK_MINUTES|int, 0, -1) %}
M117 Heat soaking: {i} min remaining…
G4 P60000 ; Dwell for 1 minute
{% endfor %}
{% endif %}

M117 Warmup complete! Ready to calibrate.
RESPOND MSG=“Warmup complete! Ambient environment is thermally stable.”
{action_respond_info(“Warmup complete! Ambient environment is thermally stable…”)}

@cardoc

Why not just set the chamber temp in filament settings, that’s what I did.

I did, the box is checked and temp is set at 60C. It doesn’t help because I can’t let the whole printer soak before it wants to print. Weather or not the fan and chamber heater turns on is a crap shoot. I don’t know why it does sometimes and othertimes it does not.

Use an editor that conforms to Linux formatting (notepad++) and replace the “curley” quote marks with “plain” quote marks.

Character	Name	Alt code
"	Straight double quote (use this in Klipper)	Alt+34
'	Straight single quote / apostrophe (use this in Klipper)	Alt+39
`	Backtick	Alt+96
“	Left curly double quote	Alt+0147
”	Right curly double quote	Alt+0148
‘	Left curly single quote	Alt+0145
’	Right curly single quote	Alt+0146

If your keyboard has a numpad you can hold down the [alt] key and enter the code numbers to force the quotes to “straight”

And if it still doesn’t work, submit it to Claude or Grok along with a detailed explanation and they can fix it.