fix(imex): give the printing head its second-layer temperature in parallel modes

The IMEX branch of the 1st->2nd layer temperature transition is mutually
exclusive with the standard per-extruder path in its `else`, but it skipped the
head carrying the print's own toolpaths on the premise that "the standard
per-extruder temp path already addresses it". That path is the `else` branch and
never runs for a parallel mode, so the printing head received no transition at
all and held nozzle_temperature_initial_layer for the entire job.

Emit for every carriage the mode drives, the printing one included. The printing
head takes this layer's own filament; the parallel carriages, which carry no
toolpaths of their own, keep resolving through the per-plate head map with pem
inversion as the fallback. The lookup now goes through get_filament_config_index()
like the standard path, since a variant-expanded printer gives a filament its own
column and a raw index would read the wrong one.

Reproduced on a 4-carriage IQEX in copy mode: the only temperature command in the
whole file set the idle secondary carriage to the value it already had, while the
head doing the printing never left its first-layer temperature. The defect is
invisible whenever initial and regular temperatures match, which is why earlier
per-tool validation passed.

Tests cover both gantry counts, since the active set comes from the mode's tool
roster: an IDEX copy mode drives two carriages, an IQEX mode drives four, and the
IQEX case asserts a first-layer filament and a second-layer transition for each of
the four.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clifford Garwood
2026-08-22 12:37:28 -04:00
co-authored by Claude Opus 5
parent 8a5bc75e7b
commit c94e8324d0
2 changed files with 135 additions and 10 deletions
+13 -10
View File
@@ -3885,6 +3885,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
// for the PA setting lookup. Guarded on non-empty pem above.
const int initial_physical = m_config.physical_extruder_map.get_at((int)initial_extruder_id);
for (int tool_idx : get_imex_active_tools(print)) {
// Unlike the second-layer temperature loop, the primary is skipped here:
// set_extruder() above already emitted its PA with the pem tool qualifier.
if (tool_idx == initial_physical) continue;
const int logical = resolve_filament_for_head(
m_imex_head_filament_map, m_config.physical_extruder_map, tool_idx);
@@ -5902,20 +5904,21 @@ LayerResult GCode::process_layer(
// All active tools need explicit temps — none receive tool-change commands,
// so we can't rely on the condition used for non-IMEX (temp != initial_layer_temp).
// A tool whose initial and regular temps are the same still needs to be set here.
// Skip the primary head: its filament is governed by the object sidebar and
// the standard per-extruder temp path already addresses it (matching the PA
// emission site above). `tool_idx` is physical; resolve to a filament slot
// via pem inversion for temp lookup.
const int num_nozzles = (int)print.config().nozzle_temperature.values.size();
// Mutually exclusive with the `else` below, so a head skipped here gets no
// transition at all. `tool_idx` is physical; the printing head uses this layer's
// own filament, the parallel carriages resolve through the head map.
const int num_filament_columns = (int)print.config().nozzle_temperature.values.size();
const int initial_physical = m_config.physical_extruder_map.values.empty()
? -1
: m_config.physical_extruder_map.get_at((int)first_extruder_id);
for (int tool_idx : get_imex_active_tools(print)) {
if (tool_idx == initial_physical) continue;
const int logical = resolve_filament_for_head(
m_imex_head_filament_map, m_config.physical_extruder_map, tool_idx);
if (logical < 0 || logical >= num_nozzles) continue;
int temperature = print.config().nozzle_temperature.values[logical];
const int logical = (tool_idx == initial_physical)
? (int)first_extruder_id
: resolve_filament_for_head(
m_imex_head_filament_map, m_config.physical_extruder_map, tool_idx);
if (logical < 0 || logical >= num_filament_columns) continue;
// Variant-expanded printers column each filament; index as the `else` does.
int temperature = print.config().nozzle_temperature.get_at(get_filament_config_index(logical));
if (temperature > 0)
gcode += GCodeWriter::set_temperature(temperature, m_writer.config.gcode_flavor, false,
tool_idx, "set IMEX tool temperature");