mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 08:25:56 +08:00
parent
f8bad7aa77
commit
e106dd555c
@ -30,7 +30,10 @@ page:Cooling:time
|
||||
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
|
||||
line:Bridges fan speed
|
||||
setting:label$:bridge_fan_speed
|
||||
setting:label$Infill bridges:bridge_internal_fan_speed
|
||||
end_line
|
||||
setting:top_fan_speed
|
||||
setting:external_perimeter_fan_speed
|
||||
line:Disable fan for the first
|
||||
|
@ -3965,7 +3965,9 @@ std::string GCode::_before_extrude(const ExtrusionPath &path, const std::string
|
||||
|
||||
std::string comment;
|
||||
if (m_enable_cooling_markers) {
|
||||
if (is_bridge(path.role()))
|
||||
if(path.role() == erInternalBridgeInfill)
|
||||
gcode += ";_BRIDGE_INTERNAL_FAN_START\n";
|
||||
else if (is_bridge(path.role()))
|
||||
gcode += ";_BRIDGE_FAN_START\n";
|
||||
else if (ExtrusionRole::erTopSolidInfill == path.role())
|
||||
gcode += ";_TOP_FAN_START\n";
|
||||
@ -3984,7 +3986,9 @@ std::string GCode::_before_extrude(const ExtrusionPath &path, const std::string
|
||||
std::string GCode::_after_extrude(const ExtrusionPath &path) {
|
||||
std::string gcode;
|
||||
if (m_enable_cooling_markers)
|
||||
if (is_bridge(path.role()))
|
||||
if (path.role() == erInternalBridgeInfill)
|
||||
gcode += ";_BRIDGE_INTERNAL_FAN_END\n";
|
||||
else if (is_bridge(path.role()))
|
||||
gcode += ";_BRIDGE_FAN_END\n";
|
||||
else if (ExtrusionRole::erTopSolidInfill == path.role())
|
||||
gcode += ";_TOP_FAN_END\n";
|
||||
|
@ -342,7 +342,7 @@ private:
|
||||
AvoidCrossingPerimeters m_avoid_crossing_perimeters;
|
||||
bool m_enable_loop_clipping;
|
||||
// If enabled, the G-code generator will put following comments at the ends
|
||||
// of the G-code lines: _EXTRUDE_SET_SPEED, _WIPE, _BRIDGE_FAN_START, _BRIDGE_FAN_END
|
||||
// of the G-code lines: _EXTRUDE_SET_SPEED, _WIPE, _BRIDGE_FAN_START, _BRIDGE_FAN_END, _BRIDGE_INTERNAL_FAN_START, _BRIDGE_INTERNAL_FAN_END
|
||||
// Those comments are received and consumed (removed from the G-code) by the CoolingBuffer.pm Perl module.
|
||||
bool m_enable_cooling_markers;
|
||||
// Markers for the Pressure Equalizer to recognize the extrusion type.
|
||||
|
@ -34,22 +34,24 @@ void CoolingBuffer::reset()
|
||||
|
||||
struct CoolingLine
|
||||
{
|
||||
enum Type {
|
||||
enum Type : uint32_t {
|
||||
TYPE_SET_TOOL = 1 << 0,
|
||||
TYPE_EXTRUDE_END = 1 << 1,
|
||||
TYPE_BRIDGE_FAN_START = 1 << 2,
|
||||
TYPE_BRIDGE_FAN_END = 1 << 3,
|
||||
TYPE_TOP_FAN_START = 1 << 4,
|
||||
TYPE_TOP_FAN_END = 1 << 5,
|
||||
TYPE_G0 = 1 << 6,
|
||||
TYPE_G1 = 1 << 7,
|
||||
TYPE_ADJUSTABLE = 1 << 8,
|
||||
TYPE_EXTERNAL_PERIMETER = 1 << 9,
|
||||
TYPE_BRIDGE_INTERNAL_FAN_START = 1 << 4,
|
||||
TYPE_BRIDGE_INTERNAL_FAN_END = 1 << 5,
|
||||
TYPE_TOP_FAN_START = 1 << 6,
|
||||
TYPE_TOP_FAN_END = 1 << 7,
|
||||
TYPE_G0 = 1 << 8,
|
||||
TYPE_G1 = 1 << 9,
|
||||
TYPE_ADJUSTABLE = 1 << 10,
|
||||
TYPE_EXTERNAL_PERIMETER = 1 << 11,
|
||||
// The line sets a feedrate.
|
||||
TYPE_HAS_F = 1 << 10,
|
||||
TYPE_WIPE = 1 << 11,
|
||||
TYPE_G4 = 1 << 12,
|
||||
TYPE_G92 = 1 << 13,
|
||||
TYPE_HAS_F = 1 << 12,
|
||||
TYPE_WIPE = 1 << 13,
|
||||
TYPE_G4 = 1 << 14,
|
||||
TYPE_G92 = 1 << 15,
|
||||
};
|
||||
|
||||
CoolingLine(unsigned int type, size_t line_start, size_t line_end) :
|
||||
@ -487,6 +489,10 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
||||
line.type = CoolingLine::TYPE_BRIDGE_FAN_START;
|
||||
} else if (boost::starts_with(sline, ";_BRIDGE_FAN_END")) {
|
||||
line.type = CoolingLine::TYPE_BRIDGE_FAN_END;
|
||||
} else if (boost::starts_with(sline, ";_BRIDGE_INTERNAL_FAN_START")) {
|
||||
line.type = CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_START;
|
||||
} else if (boost::starts_with(sline, ";_BRIDGE_INTERNAL_FAN_END")) {
|
||||
line.type = CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_END;
|
||||
} else if (boost::starts_with(sline, ";_TOP_FAN_START")) {
|
||||
line.type = CoolingLine::TYPE_TOP_FAN_START;
|
||||
} else if (boost::starts_with(sline, ";_TOP_FAN_END")) {
|
||||
@ -735,22 +741,27 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
int fan_speed = -1;
|
||||
bool bridge_fan_control = false;
|
||||
int bridge_fan_speed = 0;
|
||||
bool bridge_internal_fan_control = false;
|
||||
int bridge_internal_fan_speed = 0;
|
||||
bool top_fan_control = false;
|
||||
int top_fan_speed = 0;
|
||||
bool ext_peri_fan_control = false;
|
||||
int ext_peri_fan_speed = 0;
|
||||
auto change_extruder_set_fan = [this, layer_id, layer_time, &new_gcode, &fan_speed, &bridge_fan_control, &bridge_fan_speed, &top_fan_control, &top_fan_speed, &ext_peri_fan_control, &ext_peri_fan_speed]() {
|
||||
auto change_extruder_set_fan = [this, layer_id, layer_time, &new_gcode, &fan_speed, &bridge_fan_control, &bridge_fan_speed, &bridge_internal_fan_control, &bridge_internal_fan_speed, &top_fan_control, &top_fan_speed, &ext_peri_fan_control, &ext_peri_fan_speed]() {
|
||||
const FullPrintConfig &config = m_gcodegen.config();
|
||||
#define EXTRUDER_CONFIG(OPT) config.OPT.get_at(m_current_extruder)
|
||||
int min_fan_speed = EXTRUDER_CONFIG(min_fan_speed);
|
||||
bridge_fan_speed = EXTRUDER_CONFIG(bridge_fan_speed);
|
||||
bridge_internal_fan_speed = EXTRUDER_CONFIG(bridge_internal_fan_speed);
|
||||
top_fan_speed = EXTRUDER_CONFIG(top_fan_speed);
|
||||
ext_peri_fan_speed = EXTRUDER_CONFIG(external_perimeter_fan_speed);
|
||||
// 0 is deprecated for disable: take care of temp settings.
|
||||
if (bridge_fan_speed == 0) bridge_fan_speed = -1;
|
||||
if (bridge_internal_fan_speed == 0) bridge_internal_fan_speed = -1;
|
||||
if (ext_peri_fan_speed == 0) ext_peri_fan_speed = -1;
|
||||
if (top_fan_speed == 0) top_fan_speed = -1;
|
||||
if (bridge_fan_speed == 1) bridge_fan_speed = 0;
|
||||
if (bridge_internal_fan_speed == 1) bridge_internal_fan_speed = 0;
|
||||
if (ext_peri_fan_speed == 1) ext_peri_fan_speed = 0;
|
||||
if (top_fan_speed == 1) top_fan_speed = 0;
|
||||
// end deprecation
|
||||
@ -771,6 +782,8 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
fan_speed_new = int(floor(t * min_fan_speed + (1. - t) * max_fan_speed) + 0.5);
|
||||
if (bridge_fan_speed >= 0 && bridge_fan_speed < max_fan_speed)
|
||||
bridge_fan_speed = int(floor(t * bridge_fan_speed + (1. - t) * max_fan_speed) + 0.5);
|
||||
if (bridge_internal_fan_speed >= 0 && bridge_internal_fan_speed < max_fan_speed)
|
||||
bridge_internal_fan_speed = int(floor(t * bridge_internal_fan_speed + (1. - t) * max_fan_speed) + 0.5);
|
||||
if (top_fan_speed >= 0 && top_fan_speed < max_fan_speed)
|
||||
top_fan_speed = int(floor(t * top_fan_speed + (1. - t) * max_fan_speed) + 0.5);
|
||||
if (ext_peri_fan_speed >= 0 && ext_peri_fan_speed < max_fan_speed)
|
||||
@ -787,16 +800,27 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
// Ramp up the fan speed from disable_fan_first_layers to full_fan_speed_layer.
|
||||
float factor = float(int(layer_id + 1) - disable_fan_first_layers) / float(full_fan_speed_layer - disable_fan_first_layers);
|
||||
fan_speed_new = clamp(0, 255, int(float(fan_speed_new ) * factor + 0.5f));
|
||||
if(bridge_fan_speed >= 0)
|
||||
if (bridge_fan_speed >= 0)
|
||||
bridge_fan_speed = clamp(0, 255, int(float(bridge_fan_speed) * factor + 0.5f));
|
||||
if (bridge_internal_fan_speed >= 0)
|
||||
bridge_internal_fan_speed = clamp(0, 255, int(float(bridge_internal_fan_speed) * factor + 0.5f));
|
||||
}
|
||||
#undef EXTRUDER_CONFIG
|
||||
bridge_fan_control = bridge_fan_speed > fan_speed_new && bridge_fan_speed >= 0;
|
||||
bridge_internal_fan_control = bridge_internal_fan_speed > fan_speed_new && bridge_internal_fan_speed >= 0;
|
||||
top_fan_control = top_fan_speed != fan_speed_new && top_fan_speed >= 0;
|
||||
ext_peri_fan_control = ext_peri_fan_speed != fan_speed_new && ext_peri_fan_speed >= 0;
|
||||
// if bridge_internal_fan is disabled, it takes teh value of bridge_fan_control
|
||||
if (!bridge_internal_fan_control && bridge_fan_control) {
|
||||
bridge_internal_fan_control = true;
|
||||
bridge_internal_fan_speed = bridge_fan_speed;
|
||||
}
|
||||
|
||||
} else {
|
||||
bridge_fan_control = false;
|
||||
bridge_fan_speed = 0;
|
||||
bridge_internal_fan_control = false;
|
||||
bridge_internal_fan_speed = 0;
|
||||
top_fan_control = false;
|
||||
top_fan_speed = 0;
|
||||
ext_peri_fan_control = false;
|
||||
@ -837,6 +861,16 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
fan_need_set = true;
|
||||
current_fan_sections.erase(CoolingLine::TYPE_BRIDGE_FAN_START);
|
||||
}
|
||||
} else if (line->type & CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_START) {
|
||||
if (bridge_internal_fan_control && current_fan_sections.find(CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_START) == current_fan_sections.end()) {
|
||||
fan_need_set = true;
|
||||
current_fan_sections.insert(CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_START);
|
||||
}
|
||||
} else if (line->type & CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_END) {
|
||||
if (bridge_internal_fan_control || current_fan_sections.find(CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_START) != current_fan_sections.end()) {
|
||||
fan_need_set = true;
|
||||
current_fan_sections.erase(CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_START);
|
||||
}
|
||||
} else if (line->type & CoolingLine::TYPE_TOP_FAN_START) {
|
||||
if (top_fan_control && current_fan_sections.find(CoolingLine::TYPE_TOP_FAN_START) == current_fan_sections.end()) {
|
||||
fan_need_set = true;
|
||||
@ -931,8 +965,10 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
}
|
||||
if (fan_need_set) {
|
||||
//choose the speed with highest priority
|
||||
if(current_fan_sections.find(CoolingLine::TYPE_BRIDGE_FAN_START) != current_fan_sections.end())
|
||||
if (current_fan_sections.find(CoolingLine::TYPE_BRIDGE_FAN_START) != current_fan_sections.end())
|
||||
new_gcode += m_gcodegen.writer().set_fan(bridge_fan_speed);
|
||||
else if (current_fan_sections.find(CoolingLine::TYPE_BRIDGE_INTERNAL_FAN_START) != current_fan_sections.end())
|
||||
new_gcode += m_gcodegen.writer().set_fan(bridge_internal_fan_speed);
|
||||
else if (current_fan_sections.find(CoolingLine::TYPE_TOP_FAN_START) != current_fan_sections.end())
|
||||
new_gcode += m_gcodegen.writer().set_fan(top_fan_speed);
|
||||
else if (current_fan_sections.find(CoolingLine::TYPE_EXTERNAL_PERIMETER) != current_fan_sections.end())
|
||||
|
@ -673,6 +673,7 @@ const std::vector<std::string>& Preset::filament_options()
|
||||
"min_fan_speed",
|
||||
"max_fan_speed",
|
||||
"bridge_fan_speed",
|
||||
"bridge_internal_fan_speed",
|
||||
"top_fan_speed",
|
||||
"disable_fan_first_layers",
|
||||
"fan_below_layer_time",
|
||||
|
@ -81,6 +81,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|
||||
"between_objects_gcode",
|
||||
"bridge_acceleration",
|
||||
"bridge_fan_speed",
|
||||
"bridge_internal_fan_speed",
|
||||
"colorprint_heights",
|
||||
"complete_objects_sort",
|
||||
"cooling",
|
||||
|
@ -330,7 +330,7 @@ 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. It won't slow down the fan if it's currently running at a higher speed."
|
||||
def->tooltip = L("This fan speed is enforced during bridges and overhangs. It won't slow down the fan if it's currently running at a higher speed."
|
||||
"\nSet to 1 to disable the fan."
|
||||
"\nSet to -1 to disable this override."
|
||||
"\nCan only be overriden by disable_fan_first_layers.");
|
||||
@ -338,7 +338,20 @@ void PrintConfigDef::init_fff_params()
|
||||
def->min = -1;
|
||||
def->max = 100;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionInts { 100 });
|
||||
def->set_default_value(new ConfigOptionInts{ 100 });
|
||||
|
||||
def = this->add("bridge_internal_fan_speed", coInts);
|
||||
def->label = L("Infill bridges fan speed");
|
||||
def->category = OptionCategory::cooling;
|
||||
def->tooltip = L("This fan speed is enforced during all infill bridges. It won't slow down the fan if it's currently running at a higher speed."
|
||||
"\nSet to 1 to disable the fan."
|
||||
"\nSet to -1 to disable this override (will take the value of Bridges fan speed)."
|
||||
"\nCan only be overriden by disable_fan_first_layers.");
|
||||
def->sidetext = L("%");
|
||||
def->min = -1;
|
||||
def->max = 100;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionInts{ -1 });
|
||||
|
||||
def = this->add("top_fan_speed", coInts);
|
||||
def->label = L("Top fan speed");
|
||||
@ -5460,6 +5473,7 @@ void PrintConfigDef::to_prusa(t_config_option_key& opt_key, std::string& value,
|
||||
"avoid_crossing_not_first_layer",
|
||||
"top_fan_speed",
|
||||
"over_bridge_flow_ratio",
|
||||
"bridge_internal_fan_speed",
|
||||
"bridge_overlap",
|
||||
"bridge_speed_internal",
|
||||
"brim_inside_holes",
|
||||
|
@ -1276,6 +1276,7 @@ public:
|
||||
ConfigOptionInts bed_temperature;
|
||||
ConfigOptionFloatOrPercent bridge_acceleration;
|
||||
ConfigOptionInts bridge_fan_speed;
|
||||
ConfigOptionInts bridge_internal_fan_speed;
|
||||
ConfigOptionInts chamber_temperature;
|
||||
ConfigOptionBool complete_objects;
|
||||
ConfigOptionBool complete_objects_one_skirt;
|
||||
@ -1375,6 +1376,7 @@ protected:
|
||||
OPT_PTR(bed_temperature);
|
||||
OPT_PTR(bridge_acceleration);
|
||||
OPT_PTR(bridge_fan_speed);
|
||||
OPT_PTR(bridge_internal_fan_speed);
|
||||
OPT_PTR(chamber_temperature);
|
||||
OPT_PTR(complete_objects);
|
||||
OPT_PTR(complete_objects_one_skirt);
|
||||
|
@ -22,6 +22,7 @@ std::string PresetHints::cooling_description(const Preset &preset)
|
||||
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 bridge_internal_fan_speed = preset.config.opt_int("bridge_internal_fan_speed", 0);
|
||||
int ext_peri_fan_speed = preset.config.opt_int("external_perimeter_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);
|
||||
@ -32,9 +33,11 @@ std::string PresetHints::cooling_description(const Preset &preset)
|
||||
//for the time being, -1 shoudl eb for disabel, but it's 0 from legacy.
|
||||
if (top_fan_speed == 0) top_fan_speed = -1;
|
||||
if (bridge_fan_speed == 0) bridge_fan_speed = -1;
|
||||
if (bridge_internal_fan_speed == 0) bridge_internal_fan_speed = -1;
|
||||
if (ext_peri_fan_speed == 0) ext_peri_fan_speed = -1;
|
||||
if (top_fan_speed == 1) top_fan_speed = 0;
|
||||
if (bridge_fan_speed == 1) bridge_fan_speed = 0;
|
||||
if (bridge_internal_fan_speed == 1) bridge_internal_fan_speed = 0;
|
||||
if (ext_peri_fan_speed == 1) ext_peri_fan_speed = 0;
|
||||
|
||||
//if (preset.config.opt_bool("cooling", 0)) {
|
||||
@ -52,6 +55,9 @@ std::string PresetHints::cooling_description(const Preset &preset)
|
||||
if (bridge_fan_speed >= 0 && bridge_fan_speed > min_fan_speed) {
|
||||
out += ", " + (boost::format(_utf8(L("at %1%%% over bridges"))) % bridge_fan_speed).str();
|
||||
}
|
||||
if (bridge_internal_fan_speed >= 0 && bridge_internal_fan_speed > min_fan_speed) {
|
||||
out += ", " + (boost::format(_utf8(L("at %1%%% over infill bridges"))) % bridge_internal_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)
|
||||
@ -79,9 +85,14 @@ std::string PresetHints::cooling_description(const Preset &preset)
|
||||
}
|
||||
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) {
|
||||
} else if (bridge_fan_speed > min_fan_speed) {
|
||||
out += ", " + (boost::format(_utf8(L("at %1%%% over bridges"))) % bridge_fan_speed).str() + " " + L("if it's above the current computed fan speed value");
|
||||
}
|
||||
if (bridge_internal_fan_speed > max_fan_speed) {
|
||||
out += ", " + (boost::format(_utf8(L("at %1%%% over infill bridges"))) % bridge_internal_fan_speed).str();
|
||||
} else if (bridge_internal_fan_speed > min_fan_speed) {
|
||||
out += ", " + (boost::format(_utf8(L("at %1%%% over infill bridges"))) % bridge_internal_fan_speed).str() + " " + L("if it's above the current computed fan speed value");
|
||||
}
|
||||
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)
|
||||
@ -118,6 +129,7 @@ std::string PresetHints::cooling_description(const Preset &preset)
|
||||
|
||||
//tooltip for Depractaed values
|
||||
bridge_fan_speed = preset.config.opt_int("bridge_fan_speed", 0);
|
||||
bridge_internal_fan_speed = preset.config.opt_int("bridge_internal_fan_speed", 0);
|
||||
ext_peri_fan_speed = preset.config.opt_int("external_perimeter_fan_speed", 0);
|
||||
top_fan_speed = preset.config.opt_int("top_fan_speed", 0);
|
||||
if (top_fan_speed == 0)
|
||||
@ -126,6 +138,8 @@ std::string PresetHints::cooling_description(const Preset &preset)
|
||||
out += "\n\n!!! 0 for the External perimeters fan speed is Deprecated, please set it to -1 to disable it !!!";
|
||||
if (bridge_fan_speed == 0)
|
||||
out += "\n\n!!! 0 for the Bridge fan speed is Deprecated, please set it to -1 to disable it !!!";
|
||||
if (bridge_internal_fan_speed == 0)
|
||||
out += "\n\n!!! 0 for the Infill bridge fan speed is Deprecated, please set it to -1 to disable it !!!";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user