Skip to content

Commit

Permalink
prusa3d#8467 - GCodeProcessor - Added processing of parameter 'T' for…
Browse files Browse the repository at this point in the history
… gcode lines M104
  • Loading branch information
enricoturri1966 committed Jul 11, 2022
1 parent 850b590 commit c7d44d3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/libslic3r/GCode/GCodeProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3237,8 +3237,17 @@ void GCodeProcessor::process_M83(const GCodeReader::GCodeLine& line)
void GCodeProcessor::process_M104(const GCodeReader::GCodeLine& line)
{
float new_temp;
if (line.has_value('S', new_temp))
m_extruder_temps[m_extruder_id] = new_temp;
if (line.has_value('S', new_temp)) {
size_t id = m_extruder_id;
float val;
if (line.has_value('T', val)) {
const size_t eid = static_cast<size_t>(val);
if (eid < m_extruder_temps.size())
id = eid;
}

m_extruder_temps[id] = new_temp;
}
}

void GCodeProcessor::process_M106(const GCodeReader::GCodeLine& line)
Expand Down Expand Up @@ -3279,7 +3288,7 @@ void GCodeProcessor::process_M109(const GCodeReader::GCodeLine& line)
if (line.has_value('R', new_temp)) {
float val;
if (line.has_value('T', val)) {
size_t eid = static_cast<size_t>(val);
const size_t eid = static_cast<size_t>(val);
if (eid < m_extruder_temps.size())
m_extruder_temps[eid] = new_temp;
}
Expand Down

0 comments on commit c7d44d3

Please sign in to comment.