From ffcc59a9ab5378eef5ecf3fcb77c0e1f832f4f34 Mon Sep 17 00:00:00 2001 From: Erkan Ozgur Yilmaz Date: Wed, 24 Jan 2024 23:58:07 +0000 Subject: [PATCH] Fix for #3311: Updated the previously fixed to code to keep compatibility with BBS printer . --- src/libslic3r/GCode/GCodeProcessor.cpp | 73 ++++++++++++++++++-------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 386713da008..2245dac0f9d 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1035,13 +1035,22 @@ void GCodeProcessor::apply_config(const PrintConfig& config) // Filament load / unload times are not specific to a firmware flavor. Let anybody use it if they find it useful. // As of now the fields are shown at the UI dialog in the same combo box as the ramming values, so they // are considered to be active for the single extruder multi-material printers only. - m_time_processor.filament_load_times.resize(config.filament_load_time.values.size()); - for (size_t i = 0; i < config.filament_load_time.values.size(); ++i) { - m_time_processor.filament_load_times[i] = static_cast(config.filament_load_time.values[i]); - } - m_time_processor.filament_unload_times.resize(config.filament_unload_time.values.size()); - for (size_t i = 0; i < config.filament_unload_time.values.size(); ++i) { - m_time_processor.filament_unload_times[i] = static_cast(config.filament_unload_time.values[i]); + if(s_IsBBLPrinter){ + // BBL printers use machine_load_filament_time and machine_unload_filament_time + m_time_processor.filament_load_times.resize(1); + m_time_processor.filament_load_times[0] = static_cast(config.machine_load_filament_time.value); + m_time_processor.filament_unload_times.resize(1); + m_time_processor.filament_unload_times[0] = static_cast(config.machine_unload_filament_time.value); + } else { + // for non-BBL printers use the filament_load_time and filament_unload_time + m_time_processor.filament_load_times.resize(config.filament_load_time.values.size()); + for (size_t i = 0; i < config.filament_load_time.values.size(); ++i) { + m_time_processor.filament_load_times[i] = static_cast(config.filament_load_time.values[i]); + } + m_time_processor.filament_unload_times.resize(config.filament_unload_time.values.size()); + for (size_t i = 0; i < config.filament_unload_time.values.size(); ++i) { + m_time_processor.filament_unload_times[i] = static_cast(config.filament_unload_time.values[i]); + } } for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { @@ -1250,19 +1259,34 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) m_extruder_temps.resize(m_result.extruders_count); - const ConfigOptionFloats* filament_load_time = config.option("filament_load_time"); - if (filament_load_time != nullptr) { - m_time_processor.filament_load_times.resize(filament_load_time->values.size()); - for (size_t i = 0; i < filament_load_time->values.size(); ++i) { - m_time_processor.filament_load_times[i] = static_cast(filament_load_time->values[i]); + if(s_IsBBLPrinter){ + // BBL printers use machine_load_filament_time and machine_unload_filament_time + const ConfigOptionFloat* machine_load_filament_time = config.option("machine_load_filament_time"); + if (machine_load_filament_time != nullptr){ + m_time_processor.filament_load_times.resize(1); + m_time_processor.filament_load_times[0] = static_cast(machine_load_filament_time->value); } - } - const ConfigOptionFloats* filament_unload_time = config.option("filament_unload_time"); - if (filament_unload_time != nullptr) { - m_time_processor.filament_unload_times.resize(filament_unload_time->values.size()); - for (size_t i = 0; i < filament_unload_time->values.size(); ++i) { - m_time_processor.filament_unload_times[i] = static_cast(filament_unload_time->values[i]); + const ConfigOptionFloat* machine_unload_filament_time = config.option("machine_unload_filament_time"); + if (machine_unload_filament_time != nullptr){ + m_time_processor.filament_unload_times.resize(1); + m_time_processor.filament_unload_times[0] = static_cast(machine_unload_filament_time->value); + } + } else { + // non-BBL printers use filament_load_time and filament_unload_time + const ConfigOptionFloats* filament_load_time = config.option("filament_load_time"); + if (filament_load_time != nullptr) { + m_time_processor.filament_load_times.resize(filament_load_time->values.size()); + for (size_t i = 0; i < filament_load_time->values.size(); ++i) { + m_time_processor.filament_load_times[i] = static_cast(filament_load_time->values[i]); + } + } + const ConfigOptionFloats* filament_unload_time = config.option("filament_unload_time"); + if (filament_unload_time != nullptr) { + m_time_processor.filament_unload_times.resize(filament_unload_time->values.size()); + for (size_t i = 0; i < filament_unload_time->values.size(); ++i) { + m_time_processor.filament_unload_times[i] = static_cast(filament_unload_time->values[i]); + } } } @@ -4370,10 +4394,15 @@ void GCodeProcessor::set_travel_acceleration(PrintEstimatedStatistics::ETimeMode float GCodeProcessor::get_filament_load_time(size_t extruder_id) { - return (m_time_processor.filament_load_times.empty() || m_time_processor.extruder_unloaded) ? - 0.0f : - ((extruder_id < m_time_processor.filament_load_times.size()) ? - m_time_processor.filament_load_times[extruder_id] : m_time_processor.filament_load_times.front()); + if (s_IsBBLPrinter) { + // BBS: change load time to machine config and all extruder has same value + return m_time_processor.extruder_unloaded ? 0.0f : m_time_processor.filament_load_times[0]; + } else { + return (m_time_processor.filament_load_times.empty() || m_time_processor.extruder_unloaded) ? + 0.0f : + ((extruder_id < m_time_processor.filament_load_times.size()) ? m_time_processor.filament_load_times[extruder_id] : + m_time_processor.filament_load_times.front()); + } } float GCodeProcessor::get_filament_unload_time(size_t extruder_id)