update wipe_distance

This commit is contained in:
Wang YB
2024-01-08 16:05:56 +08:00
parent 632fb9e06e
commit e706861147
6 changed files with 33 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ public:
// Reduce feedrate a bit; travel speed is often too high to move on existing material. // Reduce feedrate a bit; travel speed is often too high to move on existing material.
// Too fast = ripping of existing material; too slow = short wipe path, thus more blob. // Too fast = ripping of existing material; too slow = short wipe path, thus more blob.
static double calc_wipe_speed(const GCodeConfig &config) { return config.travel_speed.value * 0.8; } static double calc_wipe_speed(const GCodeConfig &config) { return config.wipe_distance.get_at(0)/(config.retract_length.get_at(0)/config.retract_speed.get_at(0)); }
// Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one // Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
// due to rounding (TODO: test and/or better math for this). // due to rounding (TODO: test and/or better math for this).
static double calc_xy_to_e_ratio(const GCodeConfig &config, unsigned int extruder_id) static double calc_xy_to_e_ratio(const GCodeConfig &config, unsigned int extruder_id)

View File

@@ -504,7 +504,9 @@ static std::vector<std::string> s_Preset_filament_options {
//B26 //B26
"smooth_time", "smooth_time",
//B39 //B39
"disable_rapid_cooling_fan_first_layers" "disable_rapid_cooling_fan_first_layers",
//w15
"filament_wipe_distance"
}; };
static std::vector<std::string> s_Preset_machine_limits_options { static std::vector<std::string> s_Preset_machine_limits_options {

View File

@@ -157,7 +157,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"use_relative_e_distances", "use_relative_e_distances",
"use_volumetric_e", "use_volumetric_e",
"variable_layer_height", "variable_layer_height",
"wipe" "wipe",
//w15
"wipe_distance"
}; };
static std::unordered_set<std::string> steps_ignore; static std::unordered_set<std::string> steps_ignore;

View File

@@ -2394,6 +2394,14 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionPercents { 0. }); def->set_default_value(new ConfigOptionPercents { 0. });
def = this->add("wipe_distance", coFloats);
def->label = L("Wipe Distance");
def->tooltip = L("Discribe how long the nozzle will move along the last path when retracting.");
def->sidetext = L("mm");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{2.});
def = this->add("retract_layer_change", coBools); def = this->add("retract_layer_change", coBools);
def->label = L("Retract on layer change"); def->label = L("Retract on layer change");
def->tooltip = L("This flag enforces a retraction whenever a Z move is done."); def->tooltip = L("This flag enforces a retraction whenever a Z move is done.");
@@ -3592,6 +3600,8 @@ void PrintConfigDef::init_fff_params()
"retract_length", "retract_lift", "retract_lift_above", "retract_lift_below", "retract_speed", "retract_length", "retract_lift", "retract_lift_above", "retract_lift_below", "retract_speed",
"travel_max_lift", "travel_max_lift",
"deretract_speed", "retract_restart_extra", "retract_before_travel", "retract_length_toolchange", "retract_restart_extra_toolchange", "deretract_speed", "retract_restart_extra", "retract_before_travel", "retract_length_toolchange", "retract_restart_extra_toolchange",
//w15
"wipe_distance",
//B34 //B34
"filament_diameter", "filament_diameter",
"extrusion_multiplier", "extrusion_multiplier",
@@ -3638,7 +3648,9 @@ void PrintConfigDef::init_extruder_option_keys()
//B34 //B34
"filament_diameter", "filament_diameter",
"extrusion_multiplier", "extrusion_multiplier",
"default_filament_profile" "default_filament_profile",
//w15
"wipe_distance"
}; };
m_extruder_retract_keys = { m_extruder_retract_keys = {
@@ -3661,7 +3673,8 @@ void PrintConfigDef::init_extruder_option_keys()
"travel_max_lift", "travel_max_lift",
"travel_ramping_lift", "travel_ramping_lift",
"travel_slope", "travel_slope",
"wipe" "wipe",
"wipe_distance"
}; };
assert(std::is_sorted(m_extruder_retract_keys.begin(), m_extruder_retract_keys.end())); assert(std::is_sorted(m_extruder_retract_keys.begin(), m_extruder_retract_keys.end()));
} }

View File

@@ -772,6 +772,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionString, color_change_gcode)) ((ConfigOptionString, color_change_gcode))
((ConfigOptionString, pause_print_gcode)) ((ConfigOptionString, pause_print_gcode))
((ConfigOptionString, template_custom_gcode)) ((ConfigOptionString, template_custom_gcode))
//w15
((ConfigOptionFloats, wipe_distance))
) )
static inline std::string get_extrusion_axis(const GCodeConfig &cfg) static inline std::string get_extrusion_axis(const GCodeConfig &cfg)

View File

@@ -1967,6 +1967,8 @@ std::vector<std::pair<std::string, std::vector<std::string>>> option_keys {
"filament_retract_layer_change", "filament_retract_layer_change",
"filament_wipe", "filament_wipe",
"filament_retract_before_wipe", "filament_retract_before_wipe",
//w15
"filament_wipe_distance",
}}, }},
{"Retraction when tool is disabled", { {"Retraction when tool is disabled", {
"filament_retract_length_toolchange", "filament_retract_length_toolchange",
@@ -3152,6 +3154,8 @@ const std::vector<std::string> extruder_options = {
"retract_layer_change", "wipe", "retract_before_wipe", "travel_ramping_lift", "retract_layer_change", "wipe", "retract_before_wipe", "travel_ramping_lift",
"travel_slope", "travel_max_lift", "travel_lift_before_obstacle", "travel_slope", "travel_max_lift", "travel_lift_before_obstacle",
"retract_length_toolchange", "retract_restart_extra_toolchange", "retract_length_toolchange", "retract_restart_extra_toolchange",
//w15
"wipe_distance",
}; };
void TabPrinter::build_extruder_pages(size_t n_before_extruders) void TabPrinter::build_extruder_pages(size_t n_before_extruders)
@@ -3325,6 +3329,8 @@ void TabPrinter::build_extruder_pages(size_t n_before_extruders)
optgroup->append_single_option_line("retract_layer_change", "", extruder_idx); optgroup->append_single_option_line("retract_layer_change", "", extruder_idx);
optgroup->append_single_option_line("wipe", "", extruder_idx); optgroup->append_single_option_line("wipe", "", extruder_idx);
optgroup->append_single_option_line("retract_before_wipe", "", extruder_idx); optgroup->append_single_option_line("retract_before_wipe", "", extruder_idx);
//w15
optgroup->append_single_option_line("wipe_distance", "", extruder_idx);
optgroup = page->new_optgroup(L("Retraction when tool is disabled (advanced settings for multi-extruder setups)")); optgroup = page->new_optgroup(L("Retraction when tool is disabled (advanced settings for multi-extruder setups)"));
optgroup->append_single_option_line("retract_length_toolchange", "", extruder_idx); optgroup->append_single_option_line("retract_length_toolchange", "", extruder_idx);
@@ -3554,12 +3560,14 @@ void TabPrinter::toggle_options()
// some options only apply when not using firmware retraction // some options only apply when not using firmware retraction
vec.resize(0); vec.resize(0);
vec = { "retract_speed", "deretract_speed", "retract_before_wipe", "retract_restart_extra", "wipe" }; //w15
vec = {"retract_speed", "deretract_speed", "retract_before_wipe", "retract_restart_extra", "wipe", "wipe_distance"};
for (auto el : vec) for (auto el : vec)
toggle_option(el, retraction && !use_firmware_retraction, i); toggle_option(el, retraction && !use_firmware_retraction, i);
bool wipe = m_config->opt_bool("wipe", i); bool wipe = m_config->opt_bool("wipe", i);
toggle_option("retract_before_wipe", wipe, i); toggle_option("retract_before_wipe", wipe, i);
toggle_option("wipd_distance", wipe, i);
if (use_firmware_retraction && wipe) { if (use_firmware_retraction && wipe) {
//wxMessageDialog dialog(parent(), //wxMessageDialog dialog(parent(),