Skip to content

Commit

Permalink
MACRO: fix second layer hotend temp for copy and mirror mode
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeKeck committed Oct 31, 2024
1 parent 4308f99 commit cce8cf1
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions macros/overrides.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand All @@ -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 %}


Expand Down

0 comments on commit cce8cf1

Please sign in to comment.