#9597 - GCode processor and GCodeViewer - Fixed extruder temperature after tool changes while using single extruder multi material

This commit is contained in:
enricoturri1966 2023-02-07 11:25:46 +01:00
parent 3ebaf8d73d
commit 991aedd37c
2 changed files with 15 additions and 3 deletions

View File

@ -593,9 +593,11 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
m_time_processor.filament_unload_times[i] = static_cast<float>(config.filament_unload_time.values[i]); m_time_processor.filament_unload_times[i] = static_cast<float>(config.filament_unload_time.values[i]);
} }
m_single_extruder_multi_material = config.single_extruder_multi_material;
// With MM setups like Prusa MMU2, the filaments may be expected to be parked at the beginning. // With MM setups like Prusa MMU2, the filaments may be expected to be parked at the beginning.
// Remember the parking position so the initial load is not included in filament estimate. // Remember the parking position so the initial load is not included in filament estimate.
if (config.single_extruder_multi_material && extruders_count > 1 && config.wipe_tower) { if (m_single_extruder_multi_material && extruders_count > 1 && config.wipe_tower) {
m_parking_position = float(config.parking_pos_retraction.value); m_parking_position = float(config.parking_pos_retraction.value);
m_extra_loading_move = float(config.extra_loading_move); m_extra_loading_move = float(config.extra_loading_move);
} }
@ -772,8 +774,10 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
const ConfigOptionFloat* parking_pos_retraction = config.option<ConfigOptionFloat>("parking_pos_retraction"); const ConfigOptionFloat* parking_pos_retraction = config.option<ConfigOptionFloat>("parking_pos_retraction");
const ConfigOptionFloat* extra_loading_move = config.option<ConfigOptionFloat>("extra_loading_move"); const ConfigOptionFloat* extra_loading_move = config.option<ConfigOptionFloat>("extra_loading_move");
if (single_extruder_multi_material != nullptr && wipe_tower != nullptr && parking_pos_retraction != nullptr && extra_loading_move != nullptr) { m_single_extruder_multi_material = single_extruder_multi_material != nullptr && single_extruder_multi_material->value;
if (single_extruder_multi_material->value && m_result.extruders_count > 1 && wipe_tower->value) {
if (m_single_extruder_multi_material && wipe_tower != nullptr && parking_pos_retraction != nullptr && extra_loading_move != nullptr) {
if (m_single_extruder_multi_material && m_result.extruders_count > 1 && wipe_tower->value) {
m_parking_position = float(parking_pos_retraction->value); m_parking_position = float(parking_pos_retraction->value);
m_extra_loading_move = float(extra_loading_move->value); m_extra_loading_move = float(extra_loading_move->value);
} }
@ -977,6 +981,8 @@ void GCodeProcessor::reset()
m_spiral_vase_active = false; m_spiral_vase_active = false;
m_kissslicer_toolchange_time_correction = 0.0f; m_kissslicer_toolchange_time_correction = 0.0f;
m_single_extruder_multi_material = false;
#if ENABLE_GCODE_VIEWER_DATA_CHECKING #if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_mm3_per_mm_compare.reset(); m_mm3_per_mm_compare.reset();
m_height_compare.reset(); m_height_compare.reset();
@ -3372,6 +3378,11 @@ void GCodeProcessor::process_T(const std::string_view command)
extra_time += m_kissslicer_toolchange_time_correction; extra_time += m_kissslicer_toolchange_time_correction;
simulate_st_synchronize(extra_time); simulate_st_synchronize(extra_time);
// specific to single extruder multi material, set the extruder temperature
// if not done yet
if (m_single_extruder_multi_material && m_extruder_temps[m_extruder_id] == 0.0f)
m_extruder_temps[m_extruder_id] = m_extruder_temps[old_extruder_id];
m_result.extruders_count = std::max<size_t>(m_result.extruders_count, m_extruder_id + 1); m_result.extruders_count = std::max<size_t>(m_result.extruders_count, m_extruder_id + 1);
} }

View File

@ -559,6 +559,7 @@ namespace Slic3r {
#if ENABLE_GCODE_VIEWER_STATISTICS #if ENABLE_GCODE_VIEWER_STATISTICS
std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time; std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time;
#endif // ENABLE_GCODE_VIEWER_STATISTICS #endif // ENABLE_GCODE_VIEWER_STATISTICS
bool m_single_extruder_multi_material;
enum class EProducer enum class EProducer
{ {