GCode.cpp: Fix of temperature change before print

Function set_extruder can be called before moving to the first layer, m_layer_index is then -1. We definitely don't want to set temperature for second layer in that case.
This commit is contained in:
Lukas Matena 2019-08-20 14:22:31 +02:00
parent ae9b0a401c
commit 53939796a6

View File

@ -2887,7 +2887,7 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
// Set the temperature if the wipe tower didn't (not needed for non-single extruder MM) // Set the temperature if the wipe tower didn't (not needed for non-single extruder MM)
if (m_config.single_extruder_multi_material && !m_config.wipe_tower) { if (m_config.single_extruder_multi_material && !m_config.wipe_tower) {
int temp = (m_layer_index == 0 ? m_config.first_layer_temperature.get_at(extruder_id) : int temp = (m_layer_index <= 0 ? m_config.first_layer_temperature.get_at(extruder_id) :
m_config.temperature.get_at(extruder_id)); m_config.temperature.get_at(extruder_id));
gcode += m_writer.set_temperature(temp, false); gcode += m_writer.set_temperature(temp, false);