diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 01dd5ee1c..79d6d191c 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -120,13 +120,13 @@ namespace Slic3r { gcode += gcodegen.writer().set_temperature (this->_get_temp(gcodegen) + gcodegen.config().standby_temperature_delta.value, false, extruder_id); gcode.pop_back(); - gcode += " ;cooldown\n"; + gcode += " ;cooldown\n"; // this is a marker for GCodeProcessor, so it can supress the commands when needed } } else { // Use the value from filament settings. That one is absolute, not delta. gcode += gcodegen.writer().set_temperature(filament_idle_temp.get_at(extruder_id), false, extruder_id); gcode.pop_back(); - gcode += " ;cooldown\n"; + gcode += " ;cooldown\n"; // this is a marker for GCodeProcessor, so it can supress the commands when needed } return gcode; diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index b061ebb08..a56c1e132 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -558,8 +558,7 @@ void GCodeProcessor::apply_config(const PrintConfig& config) m_flavor = config.gcode_flavor; #if ENABLE_GCODE_POSTPROCESS_BACKTRACE - m_result.backtrace_enabled = true; /*config.printer_model.value == "MK3MMU2" || config.printer_model.value == "MK3SMMU2S" || - config.printer_model.value == "MK2.5MMU2" || config.printer_model.value == "MK2.5SMMU2S" || config.printer_model.value == "MK2SMM";*/ + m_result.backtrace_enabled = is_XL_printer(config); #endif // ENABLE_GCODE_POSTPROCESS_BACKTRACE size_t extruders_count = config.nozzle_diameter.values.size(); @@ -572,11 +571,14 @@ void GCodeProcessor::apply_config(const PrintConfig& config) m_result.filament_cost.resize(extruders_count); m_extruder_temps.resize(extruders_count); m_extruder_temps_config.resize(extruders_count); + m_extruder_temps_first_layer_config.resize(extruders_count); + m_is_XL_printer = is_XL_printer(config); for (size_t i = 0; i < extruders_count; ++ i) { m_extruder_offsets[i] = to_3d(config.extruder_offset.get_at(i).cast().eval(), 0.f); m_extruder_colors[i] = static_cast(i); m_extruder_temps_config[i] = static_cast(config.temperature.get_at(i)); + m_extruder_temps_first_layer_config[i] = static_cast(config.first_layer_temperature.get_at(i)); m_result.filament_diameters[i] = static_cast(config.filament_diameter.get_at(i)); m_result.filament_densities[i] = static_cast(config.filament_density.get_at(i)); m_result.filament_cost[i] = static_cast(config.filament_cost.get_at(i)); @@ -3992,19 +3994,19 @@ void GCodeProcessor::post_process() export_lines.insert_lines(backtrace, cmd, // line inserter [tool_number, this](unsigned int id, float time, float time_diff) { - //const std::string out = "XYYY ; id:" + std::to_string(id) + " time:" + std::to_string(time) + " time diff:" + std::to_string(time_diff) + "\n"; - const std::string out = "M104 T" + std::to_string(tool_number) + " P" + std::to_string(int(std::round(time_diff))) + " S" + std::to_string(int(m_extruder_temps_config[tool_number])) + "\n"; + int temperature = int( m_layer_id != 1 ? m_extruder_temps_config[tool_number] : m_extruder_temps_first_layer_config[tool_number]); + const std::string out = "M104 T" + std::to_string(tool_number) + " P" + std::to_string(int(std::round(time_diff))) + " S" + std::to_string(temperature) + "\n"; return out; }, // line replacer - [tool_number](const std::string& line) { + [this, tool_number](const std::string& line) { if (GCodeReader::GCodeLine::cmd_is(line, "M104")) { GCodeReader::GCodeLine gline; GCodeReader reader; reader.parse_line(line, [&gline](GCodeReader& reader, const GCodeReader::GCodeLine& l) { gline = l; }); float val; - if (gline.has_value('T', val) && gline.raw().find("cooldown") != std::string::npos) { + if (gline.has_value('T', val) && gline.raw().find("cooldown") != std::string::npos && m_is_XL_printer) { if (static_cast(val) == tool_number) return std::string("; removed M104\n"); } @@ -4299,6 +4301,8 @@ void GCodeProcessor::set_travel_acceleration(PrintEstimatedStatistics::ETimeMode float GCodeProcessor::get_filament_load_time(size_t extruder_id) { + if (m_is_XL_printer) + return 4.5f; // FIXME return (m_time_processor.filament_load_times.empty() || m_time_processor.extruder_unloaded) ? 0.0f : ((extruder_id < m_time_processor.filament_load_times.size()) ? @@ -4307,6 +4311,8 @@ float GCodeProcessor::get_filament_load_time(size_t extruder_id) float GCodeProcessor::get_filament_unload_time(size_t extruder_id) { + if (m_is_XL_printer) + return 0.f; // FIXME return (m_time_processor.filament_unload_times.empty() || m_time_processor.extruder_unloaded) ? 0.0f : ((extruder_id < m_time_processor.filament_unload_times.size()) ? diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 7cc948a6f..856d5b31f 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -547,6 +547,8 @@ namespace Slic3r { ExtruderColors m_extruder_colors; ExtruderTemps m_extruder_temps; ExtruderTemps m_extruder_temps_config; + ExtruderTemps m_extruder_temps_first_layer_config; + bool m_is_XL_printer = false; float m_parking_position; float m_extra_loading_move; float m_extruded_last_z; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 2fb2b877a..fdf97cbe2 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -4935,18 +4935,21 @@ std::string get_sla_suptree_prefix(const DynamicPrintConfig &config) return slatree; } -bool is_XL_printer(const DynamicPrintConfig &cfg) +static bool is_XL_printer(const std::string& printer_model) { static constexpr const char *ALIGN_ONLY_FOR = "XL"; + return boost::algorithm::contains(printer_model, ALIGN_ONLY_FOR); +} - bool ret = false; - +bool is_XL_printer(const DynamicPrintConfig &cfg) +{ auto *printer_model = cfg.opt("printer_model"); + return printer_model && is_XL_printer(printer_model->value); +} - if (printer_model) - ret = boost::algorithm::contains(printer_model->value, ALIGN_ONLY_FOR); - - return ret; +bool is_XL_printer(const PrintConfig &cfg) +{ + return is_XL_printer(cfg.printer_model.value); } } // namespace Slic3r diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 08f3bcd2f..06f0472ae 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1192,6 +1192,7 @@ private: }; bool is_XL_printer(const DynamicPrintConfig &cfg); +bool is_XL_printer(const PrintConfig &cfg); Points get_bed_shape(const DynamicPrintConfig &cfg); Points get_bed_shape(const PrintConfig &cfg);