ENH:instead of prime_volume by filament_prime_volume

Jira: none

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: I96e7d0604da8f90678feed81833e3a634752ffff
(cherry picked from commit be02e769bb49680d6be678fc5fa73a141ca8da1c)
This commit is contained in:
qing.zhang
2025-01-20 11:31:33 +08:00
committed by Noisyfox
parent 9e024d1d4d
commit e7e6405ad3
15 changed files with 73 additions and 47 deletions

View File

@@ -1120,7 +1120,7 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
} else {
// populate wipe_volumes with prime_volume
for (unsigned int i = 0; i < number_of_extruders; ++i)
wipe_volumes.push_back(std::vector<float>(number_of_extruders, print_config->prime_volume));
wipe_volumes.push_back(std::vector<float>(number_of_extruders, print_config->filament_prime_volume.values[i]));
}
nozzle_flush_mtx.emplace_back(wipe_volumes);
}

View File

@@ -1318,7 +1318,7 @@ float WipeTower::get_auto_brim_by_height(float max_height) {
return 8.f;
}
WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, const float prime_volume, size_t initial_tool, const float wipe_tower_height) :
WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, size_t initial_tool, const float wipe_tower_height) :
m_semm(config.single_extruder_multi_material.value),
m_wipe_tower_pos(config.wipe_tower_x.get_at(plate_idx), config.wipe_tower_y.get_at(plate_idx)),
m_wipe_tower_width(float(config.prime_tower_width)),
@@ -1335,7 +1335,6 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi
m_travel_speed(config.travel_speed),
m_current_tool(initial_tool),
//wipe_volumes(flush_matrix)
m_wipe_volume(prime_volume),
m_enable_timelapse_print(config.timelapse_type.value == TimelapseType::tlSmooth),
m_filaments_change_length(config.filament_change_length.values),
m_is_multi_extruder(config.nozzle_diameter.size() > 1),

View File

@@ -167,7 +167,7 @@ public:
// width -- width of wipe tower in mm ( default 60 mm - leave as it is )
// wipe_area -- space available for one toolchange in mm
// BBS: add partplate logic
WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, const float wipe_volume, size_t initial_tool, const float wipe_tower_height);
WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, size_t initial_tool, const float wipe_tower_height);
// Set the extruder properties.
@@ -450,7 +450,6 @@ private:
size_t m_current_tool = 0;
// Orca: support mmu wipe tower
std::vector<std::vector<float>> wipe_volumes;
const float m_wipe_volume;
float m_depth_traversed = 0.f; // Current y position at the wipe tower.
bool m_current_layer_finished = false;

View File

@@ -815,7 +815,7 @@ static std::vector<std::string> s_Preset_print_options {
"skin_infill_line_width","skeleton_infill_line_width",
"top_surface_line_width", "support_line_width", "infill_wall_overlap","top_bottom_infill_wall_overlap", "bridge_flow", "internal_bridge_flow",
"elefant_foot_compensation", "elefant_foot_compensation_layers", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower",
"prime_tower_width", "prime_tower_brim_width", "prime_tower_skip_points", "prime_volume",
"prime_tower_width", "prime_tower_brim_width", "prime_tower_skip_points",
"prime_tower_rib_wall","prime_tower_extra_rib_length","prime_tower_rib_width","prime_tower_fillet_wall",
"wipe_tower_no_sparse_layers", "compatible_printers", "compatible_printers_condition", "inherits",
"flush_into_infill", "flush_into_objects", "flush_into_support",
@@ -879,7 +879,7 @@ static std::vector<std::string> s_Preset_filament_options {
"filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow", "activate_chamber_temp_control",
"filament_long_retractions_when_cut","filament_retraction_distances_when_cut", "idle_temperature",
//BBS filament change length while the extruder color
"filament_change_length"
"filament_change_length","filament_prime_volume"
};
static std::vector<std::string> s_Preset_machine_limits_options {

View File

@@ -314,7 +314,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|| opt_key == "wipe_tower_extra_flow"
|| opt_key == "wipe_tower_no_sparse_layers"
|| opt_key == "flush_volumes_matrix"
|| opt_key == "prime_volume"
|| opt_key == "filament_prime_volume"
|| opt_key == "flush_into_infill"
|| opt_key == "flush_into_support"
|| opt_key == "initial_layer_infill_speed"
@@ -2809,9 +2809,10 @@ const WipeTowerData &Print::wipe_tower_data(size_t filaments_cnt) const
if (max_height < EPSILON) return m_wipe_tower_data;
if (! is_step_done(psWipeTower) && filaments_cnt !=0) {
std::vector<double> filament_wipe_volume = m_config.filament_prime_volume.values;
double wipe_volume = get_max_element(filament_wipe_volume);
if (m_config.prime_tower_rib_wall.value) {
double layer_height = 0.08f; // hard code layer height
double wipe_volume = m_config.prime_volume;
layer_height = m_objects.front()->config().layer_height.value;
int filament_depth_count = m_config.nozzle_diameter.values.size() == 2 ? filaments_cnt : filaments_cnt - 1;
if (filaments_cnt == 1 && enable_timelapse_print())
@@ -2841,7 +2842,6 @@ const WipeTowerData &Print::wipe_tower_data(size_t filaments_cnt) const
maximum *= 0.6;
const_cast<Print *>(this)->m_wipe_tower_data.depth = maximum / (layer_height * width);
} else {
double wipe_volume = m_config.prime_volume;
if (filaments_cnt == 1 && enable_timelapse_print()) {
const_cast<Print *>(this)->m_wipe_tower_data.depth = wipe_volume / (layer_height * width);
} else {
@@ -2915,7 +2915,7 @@ void Print::_make_wipe_tower()
if (!bUseWipeTower2) {
// in BBL machine, wipe tower is only use to prime extruder. So just use a global wipe volume.
WipeTower wipe_tower(m_config, m_plate_index, m_origin, m_config.prime_volume, m_wipe_tower_data.tool_ordering.first_extruder(),
WipeTower wipe_tower(m_config, m_plate_index, m_origin, m_wipe_tower_data.tool_ordering.first_extruder(),
m_wipe_tower_data.tool_ordering.empty() ? 0.f : m_wipe_tower_data.tool_ordering.back().print_z);
wipe_tower.set_has_tpu_filament(this->has_tpu_filament());
wipe_tower.set_filament_map(this->get_filament_maps());
@@ -2980,7 +2980,7 @@ void Print::_make_wipe_tower()
volume_to_purge = std::max(0.f, volume_to_purge - grab_purge_volume);
wipe_tower.plan_toolchange((float)layer_tools.print_z, (float)layer_tools.wipe_tower_layer_height, current_filament_id, filament_id,
m_config.prime_volume, volume_to_purge);
m_config.filament_prime_volume.values[filament_id], volume_to_purge);
current_filament_id = filament_id;
nozzle_cur_filament_ids[nozzle_id] = filament_id;
}
@@ -3052,7 +3052,7 @@ void Print::_make_wipe_tower()
for (unsigned int i = 0; i < number_of_extruders; ++i) {
for (unsigned int j = 0; j < number_of_extruders; ++j) {
if (wipe_volumes[i][j] > 0) {
wipe_volumes[i][j] = m_config.prime_volume;
wipe_volumes[i][j] = m_config.filament_prime_volume.values[j];
}
}
}
@@ -3084,7 +3084,7 @@ void Print::_make_wipe_tower()
for (const auto extruder_id : layer_tools.extruders) {
if ((first_layer && extruder_id == m_wipe_tower_data.tool_ordering.all_extruders().back()) || extruder_id !=
current_extruder_id) {
float volume_to_wipe = m_config.prime_volume;
float volume_to_wipe = m_config.filament_prime_volume.values[extruder_id];
if (m_config.purge_in_prime_tower && m_config.single_extruder_multi_material) {
volume_to_wipe = wipe_volumes[current_extruder_id][extruder_id]; // total volume to wipe after this toolchange
volume_to_wipe *= m_config.flush_multiplier.get_at(0);

View File

@@ -2488,6 +2488,15 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBools { false });
// BBS
def = this->add("filament_prime_volume", coFloats);
def->label = L("Filament prime volume");
def->tooltip = L("The volume of material to prime extruder on tower.");
def->sidetext = L("mm³");
def->min = 1.0;
def->mode = comSimple;
def->set_default_value(new ConfigOptionFloats{45.});
// BBS
def = this->add("temperature_vitrification", coInts);
def->label = L("Softening temperature");
@@ -5896,14 +5905,14 @@ void PrintConfigDef::init_fff_params()
def->sidetext = "";
def->set_default_value(new ConfigOptionFloats{0.3});
// BBS
def = this->add("prime_volume", coFloat);
def->label = L("Prime volume");
def->tooltip = L("The volume of material to prime extruder on tower.");
def->sidetext = u8"mm³"; // cubic milimeters, don't need translation
def->min = 1.0;
def->mode = comSimple;
def->set_default_value(new ConfigOptionFloat(45.));
// // BBS
// def = this->add("prime_volume", coFloat);
// def->label = L("Prime volume");
// def->tooltip = L("The volume of material to prime extruder on tower.");
// def->sidetext = u8"mm³"; // cubic milimeters, don't need translation
// def->min = 1.0;
// def->mode = comSimple;
// def->set_default_value(new ConfigOptionFloat(45.));
def = this->add("wipe_tower_x", coFloats);
//def->label = L("Position X");
@@ -7071,7 +7080,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
} else if (opt_key == "wipe_tower_width") {
opt_key = "prime_tower_width";
} else if (opt_key == "wiping_volume") {
opt_key = "prime_volume";
opt_key = "filament_prime_volume";
} else if (opt_key == "wipe_tower_brim_width") {
opt_key = "prime_tower_brim_width";
} else if (opt_key == "tool_change_gcode") {
@@ -7224,6 +7233,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
"internal_bridge_support_thickness","extruder_clearance_max_radius", "top_area_threshold", "reduce_wall_solid_infill","filament_load_time","filament_unload_time",
"smooth_coefficient", "overhang_totally_speed", "silent_mode",
"overhang_speed_classic",
"prime_volume"
};
if (ignore.find(opt_key) != ignore.end()) {

View File

@@ -1472,7 +1472,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
// BBS: wipe tower is only used for priming
((ConfigOptionFloat, prime_volume))
((ConfigOptionFloats, flush_multiplier))
((ConfigOptionFloat, z_offset))
// BBS: project filaments
@@ -1510,6 +1509,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionPoint, bed_mesh_probe_distance))
((ConfigOptionFloat, adaptive_bed_mesh_margin))
((ConfigOptionFloats, filament_prime_volume))
)

View File

@@ -131,6 +131,17 @@ inline DataType round_divide(DataType dividend, DataType divisor) //!< Return di
return (dividend + divisor / 2) / divisor;
}
template<typename T>
T get_max_element(const std::vector<T> &vec)
{
static_assert(std::is_arithmetic<T>::value, "T must be of numeric type.");
if (vec.empty())
return static_cast<T>(0);
return *std::max_element(vec.begin(), vec.end());
}
// Set a path with GUI localization files.
void set_local_dir(const std::string &path);
// Return a full path to the localization directory.