From e21feab5224c2e808278c7bd8a256ec29b2def15 Mon Sep 17 00:00:00 2001 From: QIDI TECH <893239786@qq.com> Date: Thu, 13 Jun 2024 16:28:33 +0800 Subject: [PATCH] Add Resonance Avoidance --- resources/profiles/QIDITechnology.ini | 5 ++++- src/libslic3r/GCode.cpp | 6 ++++++ src/libslic3r/Preset.cpp | 2 ++ src/libslic3r/Print.cpp | 4 ++++ src/libslic3r/PrintConfig.cpp | 24 ++++++++++++++++++++++++ src/libslic3r/PrintConfig.hpp | 6 +++++- src/slic3r/GUI/Tab.cpp | 10 ++++++++++ 7 files changed, 55 insertions(+), 2 deletions(-) diff --git a/resources/profiles/QIDITechnology.ini b/resources/profiles/QIDITechnology.ini index 9bb09f6..44174a5 100644 --- a/resources/profiles/QIDITechnology.ini +++ b/resources/profiles/QIDITechnology.ini @@ -2474,7 +2474,7 @@ cooling_tube_retraction = 91.5 default_filament_profile = default_print_profile = deretract_speed = 0 -end_gcode = M141 S0\nM104 S0\nM140 S0\nG1 E-3 F1800\nG0 Z{max_layer_z + 3} F600\nG0 X0 Y0 F12000\n{if max_layer_z < max_print_height / 2}G1 Z{max_print_height / 2 + 10} F600{else}G1 Z{min(max_print_height, max_layer_z + 3)}{endif} +end_gcode = M141 S0\nM104 S0\nM140 S0\nG1 E-3 F1800\nG0 Z{min(max_print_height, max_layer_z + 3)} F600\nG0 X0 Y0 F12000\n{if max_layer_z < max_print_height / 2}G1 Z{max_print_height / 2 + 10} F600{else}G1 Z{min(max_print_height, max_layer_z + 3)}{endif} extra_loading_move = -2 extruder_colour = "" extruder_offset = 0x0 @@ -2503,7 +2503,9 @@ machine_min_extruding_rate = 0 machine_min_travel_rate = 0 max_layer_height = 0.28 max_print_height = 315 +max_resonance_avoidance_speed = 115 min_layer_height = 0.08 +min_resonance_avoidance_speed = 70 multimaterial_purging = 45 nozzle_diameter = 0.4 parking_pos_retraction = 92 @@ -2518,6 +2520,7 @@ printer_vendor = QIDI printhost_apikey = printhost_cafile = remaining_times = 1 +resonance_avoidance = 1 retract_before_travel = 1 retract_before_wipe = 0% retract_layer_change = 1 diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 7ac211a..7ddf129 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3427,6 +3427,12 @@ std::string GCodeGenerator::_extrude( // cap speed with max_volumetric_speed anyway (even if user is not using autospeed) speed = cap_speed(speed, path_attr.mm3_per_mm, m_config, m_writer.extruder()->id()); +//Y27 + if (path_attr.role == ExtrusionRole::ExternalPerimeter && m_config.opt_bool("resonance_avoidance")) { + if (speed < m_config.opt_float("max_resonance_avoidance_speed")) { + speed = std::min(speed, m_config.opt_float("min_resonance_avoidance_speed")); + } + } double F = speed * 60; // convert mm/sec to mm/min // extrude arc or line diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 9e7b733..b8296fe 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -565,6 +565,8 @@ static std::vector s_Preset_printer_options { "bed_exclude_area", //Y25 "wipe_device", +//Y27 + "resonance_avoidance", "min_resonance_avoidance_speed", "max_resonance_avoidance_speed", //Y16 "chamber_temperature", "auxiliary_fan", "chamber_fan" }; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 78eca15..26aefff 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -226,6 +226,10 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "single_extruder_multi_material" //Y25 || opt_key == "wipe_device" + //Y27 + || opt_key == "resonance_avoidance" + || opt_key == "min_resonance_avoidance_speed" + || opt_key == "max_resonance_avoidance_speed" || opt_key == "temperature" || opt_key == "idle_temperature" || opt_key == "wipe_tower" diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index a758c1e..41b724d 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2996,6 +2996,30 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionBool(false)); +//Y27 + def = this->add("resonance_avoidance", coBool); + def->label = L("Resonance avoidance"); + def->tooltip = L("By reducing the speed of the outer wall to avoid the resonance zone of the printer, ringing on the surface of the model are avoided. " + "Turn this option off when testing ringing."); + def->mode = comExpert; + def->set_default_value(new ConfigOptionBool(true)); + + def = this->add("min_resonance_avoidance_speed", coFloat); + def->label = L("Min"); + def->tooltip = L("Minimum speed of resonance avoidance."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloat(70)); + + def = this->add("max_resonance_avoidance_speed", coFloat); + def->label = L("Max"); + def->tooltip = L("Maximum speed of resonance avoidance."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloat(115)); + def = this->add("single_extruder_multi_material_priming", coBool); def->label = L("Prime all printing extruders"); def->tooltip = L("If enabled, all printing extruders will be primed at the front edge of the print bed at the start of the print."); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 0ce1beb..5ef16d2 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -535,7 +535,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionInt, raft_layers)) ((ConfigOptionEnum, seam_position)) //Y21 - ((ConfigOptionPercent, seam_gap)) + ((ConfigOptionPercent, seam_gap)) ((ConfigOptionBool, staggered_inner_seams)) // ((ConfigOptionFloat, seam_preferred_direction)) // ((ConfigOptionFloat, seam_preferred_direction_jitter)) @@ -785,6 +785,10 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, single_extruder_multi_material)) //Y25 ((ConfigOptionBool, wipe_device)) + //Y27 + ((ConfigOptionBool, resonance_avoidance)) + ((ConfigOptionFloat, min_resonance_avoidance_speed)) + ((ConfigOptionFloat, max_resonance_avoidance_speed)) ((ConfigOptionBool, single_extruder_multi_material_priming)) ((ConfigOptionBool, wipe_tower_no_sparse_layers)) ((ConfigOptionString, toolchange_gcode)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index b0d54f7..4ebf733 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2736,6 +2736,12 @@ void TabPrinter::build_fff() Option option(def, "extruders_count"); optgroup->append_single_option_line(option); optgroup->append_single_option_line("single_extruder_multi_material"); +//Y27 + optgroup->append_single_option_line("resonance_avoidance"); + Line line = { L("Resonance Avoidance Speed"), "" }; + line.append_option(optgroup->get_option("min_resonance_avoidance_speed")); + line.append_option(optgroup->get_option("max_resonance_avoidance_speed")); + optgroup->append_line(line); optgroup->m_on_change = [this, optgroup_wk = ConfigOptionsGroupWkp(optgroup)](t_config_option_key opt_key, boost::any value) { auto optgroup_sh = optgroup_wk.lock(); @@ -3607,6 +3613,10 @@ void TabPrinter::toggle_options() toggle_option("toolchange_gcode", have_multiple_extruders); if (m_active_page->title() == "General") { toggle_option("single_extruder_multi_material", have_multiple_extruders); +//Y27 + bool resonance_avoidance = m_config->opt_bool("resonance_avoidance"); + toggle_option("min_resonance_avoidance_speed", resonance_avoidance); + toggle_option("max_resonance_avoidance_speed", resonance_avoidance); bool is_marlin_flavor = flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware; // Disable silent mode for non-marlin firmwares.