fix bugs in ExtrusionEstimator
This commit is contained in:
parent
10d04529d6
commit
7edd813fc8
@ -2874,21 +2874,20 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string_view de
|
||||
!this->on_first_layer() && path.role().is_perimeter()) {
|
||||
std::vector<std::pair<int, ConfigOptionFloatOrPercent>> overhangs_with_speeds = {{100, ConfigOptionFloatOrPercent{speed, false}}};
|
||||
if (this->m_config.enable_dynamic_overhang_speeds) {
|
||||
std::vector<std::pair<int, ConfigOptionFloatOrPercent>> overhangs_with_speeds = {{0, m_config.overhang_speed_0},
|
||||
{25, m_config.overhang_speed_1},
|
||||
{50, m_config.overhang_speed_2},
|
||||
{75, m_config.overhang_speed_3},
|
||||
{100,
|
||||
ConfigOptionFloatOrPercent{speed, false}}};
|
||||
overhangs_with_speeds = {{0, m_config.overhang_speed_0},
|
||||
{25, m_config.overhang_speed_1},
|
||||
{50, m_config.overhang_speed_2},
|
||||
{75, m_config.overhang_speed_3},
|
||||
{100, ConfigOptionFloatOrPercent{speed, false}}};
|
||||
}
|
||||
|
||||
std::vector<std::pair<int, ConfigOptionInts>> overhang_w_fan_speeds = {{100, ConfigOptionInts{0}}};
|
||||
if (this->m_config.enable_dynamic_fan_speeds.get_at(m_writer.extruder()->id())) {
|
||||
std::vector<std::pair<int, ConfigOptionInts>> overhang_w_fan_speeds = {{0, m_config.overhang_fan_speed_0},
|
||||
{25, m_config.overhang_fan_speed_1},
|
||||
{50, m_config.overhang_fan_speed_2},
|
||||
{75, m_config.overhang_fan_speed_3},
|
||||
{100, ConfigOptionInts{0}}};
|
||||
overhang_w_fan_speeds = {{0, m_config.overhang_fan_speed_0},
|
||||
{25, m_config.overhang_fan_speed_1},
|
||||
{50, m_config.overhang_fan_speed_2},
|
||||
{75, m_config.overhang_fan_speed_3},
|
||||
{100, ConfigOptionInts{0}}};
|
||||
}
|
||||
|
||||
double external_perim_reference_speed = std::min(m_config.get_abs_value("external_perimeter_speed"),
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <numeric>
|
||||
#include <unordered_map>
|
||||
@ -293,13 +294,13 @@ public:
|
||||
auto interpolate_speed = [](const std::map<float, float> &values, float distance) {
|
||||
auto upper_dist = values.lower_bound(distance);
|
||||
if (upper_dist == values.end()) {
|
||||
return values.rend()->second;
|
||||
return values.rbegin()->second;
|
||||
}
|
||||
if (upper_dist == values.begin()) {
|
||||
return upper_dist->second;
|
||||
}
|
||||
|
||||
auto lower_dist = --upper_dist;
|
||||
auto lower_dist = std::prev(upper_dist);
|
||||
float t = (distance - lower_dist->first) / (upper_dist->first - lower_dist->first);
|
||||
return (1.0f - t) * lower_dist->second + t * upper_dist->second;
|
||||
};
|
||||
|
@ -224,7 +224,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
|
||||
"perimeter_speed", "small_perimeter_speed", "external_perimeter_speed", "enable_dynamic_overhang_speeds"})
|
||||
toggle_field(el, have_perimeters);
|
||||
|
||||
for (size_t i = 0; i < 5; i++) {
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
toggle_field("overhang_speed_" + std::to_string(i), config->opt_bool("enable_dynamic_overhang_speeds"));
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,10 @@ void OptionsSearcher::append_options(DynamicPrintConfig* config, Preset::Type ty
|
||||
suffix_local = " " + _(suffix);
|
||||
suffix = " " + suffix;
|
||||
}
|
||||
else if (gc.group == "Dynamic overhang speed" && id >= 0) {
|
||||
suffix = " " + std::to_string(id+1);
|
||||
suffix_local = suffix;
|
||||
}
|
||||
|
||||
if (!label.IsEmpty())
|
||||
options.emplace_back(Option{ boost::nowide::widen(key), type,
|
||||
|
Loading…
Reference in New Issue
Block a user