Hide purge tower preview in case of no tool changes

This commit is contained in:
SoftFever 2023-09-25 23:17:56 +08:00
parent f06b7cb526
commit 33f91c026a
2 changed files with 12 additions and 6 deletions

View file

@ -2256,10 +2256,7 @@ const WipeTowerData &Print::wipe_tower_data(size_t filaments_cnt) const
if (!is_step_done(psWipeTower) && filaments_cnt != 0) { if (!is_step_done(psWipeTower) && filaments_cnt != 0) {
double width = m_config.prime_tower_width; double width = m_config.prime_tower_width;
double layer_height = 0.2; // hard code layer height double layer_height = 0.2; // hard code layer height
double wipe_volume = m_config.prime_volume; if (m_config.purge_in_prime_tower) {
if (m_config.purge_in_prime_tower || (filaments_cnt == 1 && enable_timelapse_print())) {
const_cast<Print *>(this)->m_wipe_tower_data.depth = wipe_volume / (layer_height * width);
} else {
// Calculating depth should take into account currently set wiping volumes. // Calculating depth should take into account currently set wiping volumes.
// For a long time, the initial preview would just use 900/width per toolchange (15mm on a 60mm wide tower) // For a long time, the initial preview would just use 900/width per toolchange (15mm on a 60mm wide tower)
// and it worked well enough. Let's try to do slightly better by accounting for the purging volumes. // and it worked well enough. Let's try to do slightly better by accounting for the purging volumes.
@ -2269,8 +2266,17 @@ const WipeTowerData &Print::wipe_tower_data(size_t filaments_cnt) const
max_wipe_volumes.emplace_back(*std::max_element(v.begin(), v.end())); max_wipe_volumes.emplace_back(*std::max_element(v.begin(), v.end()));
float maximum = std::accumulate(max_wipe_volumes.begin(), max_wipe_volumes.end(), 0.f); float maximum = std::accumulate(max_wipe_volumes.begin(), max_wipe_volumes.end(), 0.f);
maximum = maximum * filaments_cnt / max_wipe_volumes.size(); maximum = maximum * filaments_cnt / max_wipe_volumes.size();
// Orca: it's overshooting a bit, so let's reduce it a bit
maximum *= 0.6;
const_cast<Print *>(this)->m_wipe_tower_data.depth = maximum / (layer_height * width); 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 {
const_cast<Print *>(this)->m_wipe_tower_data.depth = wipe_volume * (filaments_cnt - 1) / (layer_height * width);
}
} }
const_cast<Print *>(this)->m_wipe_tower_data.brim_width = m_config.prime_tower_brim_width; const_cast<Print *>(this)->m_wipe_tower_data.brim_width = m_config.prime_tower_brim_width;
} }

View file

@ -1579,7 +1579,7 @@ Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double d) const
auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type"); auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false; bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
double depth = d; double depth = plate_extruders.size() == 1 ? 0 : d;
if (timelapse_enabled || depth > EPSILON) { if (timelapse_enabled || depth > EPSILON) {
float min_wipe_tower_depth = 0.f; float min_wipe_tower_depth = 0.f;
auto iter = WipeTower::min_depth_per_height.begin(); auto iter = WipeTower::min_depth_per_height.begin();