#260: better text & layout for filament cooling

This commit is contained in:
supermerill 2020-06-02 01:23:14 +02:00
parent f2a503cdc8
commit e68de2cf4f
5 changed files with 111 additions and 62 deletions

View File

@ -18,22 +18,20 @@ group:Temperature °C
setting:chamber_temperature
page:Cooling:time
group:Enable
setting:fan_always_on
setting:cooling
cooling_description
group:Fan settings
line:Fan speed
setting:min_fan_speed
setting:max_fan_speed
end_line
group:Fan speed - default
setting:label$Run the fan at default speed when possible:fan_always_on
setting:min_fan_speed
setting:bridge_fan_speed
setting:top_fan_speed
setting:disable_fan_first_layers
group:Cooling thresholds
group:Short layer time - began to increase base fan speed
setting:fan_below_layer_time
setting:slowdown_below_layer_time
setting:label$Max fan speed:max_fan_speed
group:Very short layer time - began to decrease extrusion rate
setting:label$Layer time goal:slowdown_below_layer_time
setting:min_print_speed
group:Behavior
cooling_description
page:Advanced:wrench
group:Filament properties

View File

@ -694,7 +694,7 @@ std::string CoolingBuffer::apply_layer_cooldown(
int max_fan_speed = EXTRUDER_CONFIG(max_fan_speed);
float slowdown_below_layer_time = float(EXTRUDER_CONFIG(slowdown_below_layer_time));
float fan_below_layer_time = float(EXTRUDER_CONFIG(fan_below_layer_time));
if (EXTRUDER_CONFIG(cooling)) {
//if (EXTRUDER_CONFIG(cooling)) {
if (layer_time < slowdown_below_layer_time) {
// Layer time very short. Enable the fan to a full throttle.
fan_speed_new = max_fan_speed;
@ -704,12 +704,12 @@ std::string CoolingBuffer::apply_layer_cooldown(
double t = (layer_time - slowdown_below_layer_time) / (fan_below_layer_time - slowdown_below_layer_time);
fan_speed_new = int(floor(t * min_fan_speed + (1. - t) * max_fan_speed) + 0.5);
}
}
//}
bridge_fan_speed = EXTRUDER_CONFIG(bridge_fan_speed);
top_fan_speed = EXTRUDER_CONFIG(top_fan_speed);
#undef EXTRUDER_CONFIG
bridge_fan_control = bridge_fan_speed > fan_speed_new;
top_fan_control = top_fan_speed != fan_speed_new;
bridge_fan_control = bridge_fan_speed > fan_speed_new && bridge_fan_speed != 0;
top_fan_control = top_fan_speed != fan_speed_new && top_fan_speed != 0;
} else {
bridge_fan_control = false;
bridge_fan_speed = 0;

View File

@ -250,7 +250,8 @@ void PrintConfigDef::init_fff_params()
def = this->add("bridge_fan_speed", coInts);
def->label = L("Bridges fan speed");
def->category = OptionCategory::cooling;
def->tooltip = L("This fan speed is enforced during all bridges and overhangs.");
def->tooltip = L("This fan speed is enforced during all bridges and overhangs. It won't slow down the fan if it's currently running at a higher speed."
"\nSet to 0 to disable this override. Can only be overriden by disable_fan_first_layers.");
def->sidetext = L("%");
def->min = 0;
def->max = 100;
@ -260,12 +261,13 @@ void PrintConfigDef::init_fff_params()
def = this->add("top_fan_speed", coInts);
def->label = L("Top fan speed");
def->category = OptionCategory::cooling;
def->tooltip = L("This fan speed is enforced during all top fills.");
def->tooltip = L("This fan speed is enforced during all top fills."
"\nSet to 0 to disable this override. Can only be overriden by disable_fan_first_layers.");
def->sidetext = L("%");
def->min = 0;
def->max = 100;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionInts{ 100 });
def->set_default_value(new ConfigOptionInts{ 0 });
def = this->add("bridge_flow_ratio", coPercent);
def->label = L("Bridge");
@ -469,6 +471,7 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back(L("lowest Z"));
def->set_default_value(new ConfigOptionEnum<CompleteObjectSort>(cosObject));
//not used anymore, to remove !! @DEPRECATED
def = this->add("cooling", coBools);
def->label = L("Enable auto cooling");
def->category = OptionCategory::cooling;
@ -955,8 +958,8 @@ void PrintConfigDef::init_fff_params()
def = this->add("fan_always_on", coBools);
def->label = L("Keep fan always on");
def->category = OptionCategory::cooling;
def->tooltip = L("If this is enabled, fan will never be disabled and will be kept running at least "
"at its minimum speed. Useful for PLA, harmful for ABS.");
def->tooltip = L("If this is enabled, fan will continuously run at base speed if no setting override the speed."
" Useful for PLA, harmful for ABS.");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBools{ false });
@ -964,7 +967,8 @@ void PrintConfigDef::init_fff_params()
def->label = L("Enable fan if layer print time is below");
def->category = OptionCategory::cooling;
def->tooltip = L("If layer print time is estimated below this number of seconds, fan will be enabled "
"and its speed will be calculated by interpolating the minimum and maximum speeds.");
"and its speed will be calculated by interpolating the default and maximum speeds."
"\nSet to 0 to disable.");
def->sidetext = L("approximate seconds");
def->min = 0;
def->max = 1000;
@ -1903,7 +1907,7 @@ void PrintConfigDef::init_fff_params()
def->label = L("Max");
def->full_label = ("Max fan speed");
def->category = OptionCategory::cooling;
def->tooltip = L("This setting represents the maximum speed of your fan.");
def->tooltip = L("This setting represents the maximum speed of your fan, used when the layer print time is Very short.");
def->sidetext = L("%");
def->min = 0;
def->max = 100;
@ -1971,10 +1975,10 @@ void PrintConfigDef::init_fff_params()
#endif /* HAS_PRESSURE_EQUALIZER */
def = this->add("min_fan_speed", coInts);
def->label = L("Min");
def->full_label = ("Min fan speed");
def->label = L("Default fan speed");
def->full_label = ("Default fan speed");
def->category = OptionCategory::cooling;
def->tooltip = L("This setting represents the minimum PWM your fan needs to work.");
def->tooltip = L("This setting represents the base fan speed this filament needs, or at least the minimum PWM your fan needs to work.");
def->sidetext = L("%");
def->min = 0;
def->max = 100;
@ -1995,7 +1999,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("min_print_speed", coFloats);
def->label = L("Min print speed");
def->category = OptionCategory::speed;
def->tooltip = L("Slic3r will not scale speed down below this speed.");
def->tooltip = L("Slic3r will never scale the speed below this one.");
def->sidetext = L("mm/s");
def->min = 0;
def->mode = comExpert;
@ -2556,12 +2560,13 @@ void PrintConfigDef::init_fff_params()
def->label = L("Slow down if layer print time is below");
def->category = OptionCategory::cooling;
def->tooltip = L("If layer print time is estimated below this number of seconds, print moves "
"speed will be scaled down to extend duration to this value.");
"speed will be scaled down to extend duration to this value, if possible."
"\nSet to 0 to disable.");
def->sidetext = L("approximate seconds");
def->min = 0;
def->max = 1000;
def->mode = comExpert;
def->set_default_value(new ConfigOptionInts { 5 });
def->set_default_value(new ConfigOptionInts{ 5 });
def = this->add("small_perimeter_speed", coFloatOrPercent);
def->label = L("Small");

View File

@ -14,45 +14,84 @@
namespace Slic3r {
#define MIN_BUF_LENGTH 4096
#define MIN_BUF_LENGTH 4096
std::string PresetHints::cooling_description(const Preset &preset)
{
std::string out;
std::string out;
int min_fan_speed = preset.config.opt_int("min_fan_speed", 0);
int max_fan_speed = preset.config.opt_int("max_fan_speed", 0);
int top_fan_speed = preset.config.opt_int("top_fan_speed", 0);
int bridge_fan_speed = preset.config.opt_int("bridge_fan_speed", 0);
int disable_fan_first_layers = preset.config.opt_int("disable_fan_first_layers", 0);
int slowdown_below_layer_time = preset.config.opt_int("slowdown_below_layer_time", 0);
int min_print_speed = int(preset.config.opt_float("min_print_speed", 0) + 0.5);
int fan_below_layer_time = preset.config.opt_int("fan_below_layer_time", 0);
if (preset.config.opt_bool("cooling", 0)) {
int slowdown_below_layer_time = preset.config.opt_int("slowdown_below_layer_time", 0);
int min_fan_speed = preset.config.opt_int("min_fan_speed", 0);
int max_fan_speed = preset.config.opt_int("max_fan_speed", 0);
int min_print_speed = int(preset.config.opt_float("min_print_speed", 0) + 0.5);
int fan_below_layer_time = preset.config.opt_int("fan_below_layer_time", 0);
//if (preset.config.opt_bool("cooling", 0)) {
out = _utf8(L("Fan"));
if (preset.config.opt_bool("fan_always_on", 0)) {
out += (boost::format(_utf8(L("If estimated layer time is below ~%1%s, "
"fan will run at %2%%% and print speed will be reduced "
"so that no less than %3%s are spent on that layer "
"(however, speed will never be reduced below %4%mm/s).")))
% slowdown_below_layer_time % max_fan_speed % slowdown_below_layer_time % min_print_speed).str();
out += " " + (boost::format(_utf8(L("will run at %1%%% by default"))) % min_fan_speed).str() ;
if (fan_below_layer_time > slowdown_below_layer_time) {
out += "\n" + (boost::format(_utf8(L("If estimated layer time is greater, but still below ~%1%s, "
"fan will run at a proportionally decreasing speed between %2%%% and %3%%%.")))
% fan_below_layer_time % max_fan_speed % min_fan_speed).str();
if (top_fan_speed > 0 && top_fan_speed != min_fan_speed) {
out += ", " + (boost::format(_utf8(L("at %1%%% over top fill surfaces"))) % top_fan_speed).str();
}
if (bridge_fan_speed > 0 && bridge_fan_speed > min_fan_speed) {
out += ", " + (boost::format(_utf8(L("at %1%%% over bridges"))) % bridge_fan_speed).str();
}
out += "\n" + _utf8(L("During the other layers, fan")) + " ";
} else {
out = _utf8(L("Fan")) + " ";
}
if (preset.config.opt_bool("fan_always_on", 0)) {
int disable_fan_first_layers = preset.config.opt_int("disable_fan_first_layers", 0);
int min_fan_speed = preset.config.opt_int("min_fan_speed", 0);
out += (boost::format(_utf8(L("will always run at %1%%%"))) % min_fan_speed).str() + " ";
if (disable_fan_first_layers > 1)
out += (boost::format(_utf8(L("except for the first %1% layers."))) % disable_fan_first_layers).str();
out += ", " + (boost::format(_utf8(L("except for the first %1% layers where the fan is disabled"))) % disable_fan_first_layers).str();
else if (disable_fan_first_layers == 1)
out += _utf8(L("except for the first layer."));
out += ", " + _utf8(L("except for the first layer where the fan is disabled"));
out += ".";
} else
out += _utf8(L("will be turned off."));
out += " " + _utf8(L("will be turned off by default."));
if (fan_below_layer_time > 0
&& fan_below_layer_time > slowdown_below_layer_time
&& max_fan_speed > min_fan_speed) {
out += (boost::format(_utf8(L("\n\nIf estimated layer time is below ~%1%s, but still greater than ~%2%s, "
"fan will run at a proportionally increasing speed between %3%%% and %4%%%")))
% fan_below_layer_time % slowdown_below_layer_time % min_fan_speed % max_fan_speed).str();
if (top_fan_speed > 0) {
out += ", " + (boost::format(_utf8(L("at %1%%% over top fill surfaces"))) % top_fan_speed).str();
}
if (bridge_fan_speed > max_fan_speed) {
out += ", " + (boost::format(_utf8(L("at %1%%% over bridges"))) % bridge_fan_speed).str();
}else if (bridge_fan_speed > min_fan_speed) {
out += ", " + (boost::format(_utf8(L("at %1%%% over bridges if it's below the current computed fan speed value"))) % bridge_fan_speed).str();
}
if (disable_fan_first_layers > 1)
out += " ; " + ((boost::format(_utf8(L("except for the first %1% layers where the fan is disabled"))) % disable_fan_first_layers).str());
else if (disable_fan_first_layers == 1)
out += " ; "+ _utf8(L("except for the first layer where the fan is disabled"));
out += ".";
}
if (slowdown_below_layer_time > 0) {
out += (boost::format(_utf8(L("\n\nIf estimated layer time is below ~%1%s")))
% slowdown_below_layer_time).str();
if (max_fan_speed > 0 && max_fan_speed > min_fan_speed) {
out += " " + (boost::format(_utf8(L("fan will run by default to %1%%%")))
% max_fan_speed).str();
if (disable_fan_first_layers > 1)
out += " (" + (boost::format(_utf8(L("except for the first %1% layers where the fan is disabled"))) % disable_fan_first_layers).str() + ")";
else if (disable_fan_first_layers == 1)
out += " (" + _utf8(L("except for the first layer where the fan is disabled")) + ")";
out += " and";
}
out += " " + (boost::format(_utf8(L("print speed will be reduced "
"so that no less than %1%s are spent on that layer "
"(however, speed will never be reduced below %2%mm/s).")))
% slowdown_below_layer_time % min_print_speed).str();
}
return out;
}

View File

@ -1886,11 +1886,18 @@ void TabFilament::update()
bool cooling = m_config->opt_bool("cooling", 0);
bool fan_always_on = cooling || m_config->opt_bool("fan_always_on", 0);
for (auto el : { "max_fan_speed", "fan_below_layer_time", "slowdown_below_layer_time", "min_print_speed" })
get_field(el)->toggle(cooling);
//get_field("max_fan_speed")->toggle(m_config->opt_int("fan_below_layer_time", 0) > 0);
get_field("min_print_speed")->toggle(m_config->opt_int("slowdown_below_layer_time", 0) > 0);
for (auto el : { "min_fan_speed", "disable_fan_first_layers" })
get_field(el)->toggle(fan_always_on);
// hidden 'cooling', it's now deactivated.
//for (auto el : { "max_fan_speed", "fan_below_layer_time", "slowdown_below_layer_time", "min_print_speed" })
// get_field(el)->toggle(cooling);
//for (auto el : { "min_fan_speed", "disable_fan_first_layers" })
// get_field(el)->toggle(fan_always_on);
get_field("max_fan_speed")->toggle(m_config->opt_int("fan_below_layer_time", 0) > 0 || m_config->opt_int("slowdown_below_layer_time", 0) > 0);
update_filament_overrides_page();