From cce8cf1ad29432212f577c1553f29b56855e69b0 Mon Sep 17 00:00:00 2001 From: HelgeKeck Date: Thu, 31 Oct 2024 13:37:02 +0100 Subject: [PATCH] MACRO: fix second layer hotend temp for copy and mirror mode --- macros/overrides.cfg | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/macros/overrides.cfg b/macros/overrides.cfg index ba435e8a..1eadbf56 100644 --- a/macros/overrides.cfg +++ b/macros/overrides.cfg @@ -43,14 +43,33 @@ gcode: {% set t = params.T|default(-1)|int %} {% set t = 0 if t == -1 else t %} + # IDEX mode + {% set idex_mode = '' %} + {% if printer["dual_carriage"] is defined %} + {% set idex_mode = printer["dual_carriage"].carriage_1|lower %} + {% endif %} + DEBUG_ECHO PREFIX="M104" MSG="s: {s}, t: {t}" # set temperature offset {% if printer["gcode_macro T%s" % t] is defined %} - {% set temperature_offset = printer["gcode_macro T%s" % t].temperature_offset|default(0)|int %} - {% set s = [s + temperature_offset, 0]|max %} - {% if temperature_offset != 0 %} - RATOS_ECHO PREFIX="M104" MSG="Temperature offset of {temperature_offset}°C added to toolhead T{t}." + {% if idex_mode == "copy" or idex_mode == "mirror" %} + {% set temperature_offset_t0 = printer["gcode_macro T0"].temperature_offset|default(0)|int %} + {% set temperature_offset_t1 = printer["gcode_macro T1"].temperature_offset|default(0)|int %} + {% set s0 = [s + temperature_offset_t0, 0]|max %} + {% set s1 = [s + temperature_offset_t1, 0]|max %} + {% if temperature_offset_t0 != 0 %} + RATOS_ECHO PREFIX="M104" MSG="Temperature offset of {temperature_offset_t0}°C added to toolhead T0." + {% endif %} + {% if temperature_offset_t1 != 0 %} + RATOS_ECHO PREFIX="M104" MSG="Temperature offset of {temperature_offset_t1}°C added to toolhead T1." + {% endif %} + {% else %} + {% set temperature_offset = printer["gcode_macro T%s" % t].temperature_offset|default(0)|int %} + {% set s = [s + temperature_offset, 0]|max %} + {% if temperature_offset != 0 %} + RATOS_ECHO PREFIX="M104" MSG="Temperature offset of {temperature_offset}°C added to toolhead T{t}." + {% endif %} {% endif %} {% endif %} @@ -65,7 +84,12 @@ gcode: # call klipper base function {% if not is_in_standby %} - M104.1 S{s} T{t} + {% if idex_mode == "copy" or idex_mode == "mirror" %} + M104.1 S{s0} T0 + M104.1 S{s1} T1 + {% else %} + M104.1 S{s} T{t} + {% endif %} {% endif %}