mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-17 19:57:55 -06:00
Support interface fan speed
This commit is contained in:
parent
be4373583f
commit
da90e22b9f
7 changed files with 93 additions and 22 deletions
|
@ -4114,6 +4114,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
auto overhang_fan_threshold = EXTRUDER_CONFIG(overhang_fan_threshold);
|
auto overhang_fan_threshold = EXTRUDER_CONFIG(overhang_fan_threshold);
|
||||||
auto enable_overhang_bridge_fan = EXTRUDER_CONFIG(enable_overhang_bridge_fan);
|
auto enable_overhang_bridge_fan = EXTRUDER_CONFIG(enable_overhang_bridge_fan);
|
||||||
|
|
||||||
|
auto supp_interface_fan_speed = EXTRUDER_CONFIG(support_material_interface_fan_speed);
|
||||||
|
|
||||||
|
|
||||||
// { "0%", Overhang_threshold_none },
|
// { "0%", Overhang_threshold_none },
|
||||||
// { "5%", Overhang_threshold_1_4 },
|
// { "5%", Overhang_threshold_1_4 },
|
||||||
|
@ -4151,12 +4153,14 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
comment += ";_EXTERNAL_PERIMETER";
|
comment += ";_EXTERNAL_PERIMETER";
|
||||||
}
|
}
|
||||||
bool is_overhang_fan_on = false;
|
bool is_overhang_fan_on = false;
|
||||||
|
bool is_supp_interface_fan_on = false;
|
||||||
if (!variable_speed) {
|
if (!variable_speed) {
|
||||||
// F is mm per minute.
|
// F is mm per minute.
|
||||||
gcode += m_writer.set_speed(F, "", comment);
|
gcode += m_writer.set_speed(F, "", comment);
|
||||||
double path_length = 0.;
|
double path_length = 0.;
|
||||||
{
|
{
|
||||||
if (m_enable_cooling_markers && enable_overhang_bridge_fan) {
|
if (m_enable_cooling_markers) {
|
||||||
|
if (enable_overhang_bridge_fan) {
|
||||||
// BBS: Overhang_threshold_none means Overhang_threshold_1_4 and forcing cooling for all external
|
// BBS: Overhang_threshold_none means Overhang_threshold_1_4 and forcing cooling for all external
|
||||||
// perimeter
|
// perimeter
|
||||||
int overhang_threshold = overhang_fan_threshold == Overhang_threshold_none ? Overhang_threshold_none
|
int overhang_threshold = overhang_fan_threshold == Overhang_threshold_none ? Overhang_threshold_none
|
||||||
|
@ -4167,6 +4171,11 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
is_overhang_fan_on = true;
|
is_overhang_fan_on = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(supp_interface_fan_speed >= 0 && path.role() == erSupportMaterialInterface) {
|
||||||
|
gcode += ";_SUPP_INTERFACE_FAN_START\n";
|
||||||
|
is_supp_interface_fan_on = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
// BBS: use G1 if not enable arc fitting or has no arc fitting result or in spiral_mode mode
|
// BBS: use G1 if not enable arc fitting or has no arc fitting result or in spiral_mode mode
|
||||||
// Attention: G2 and G3 is not supported in spiral_mode mode
|
// Attention: G2 and G3 is not supported in spiral_mode mode
|
||||||
if (!m_config.enable_arc_fitting || path.polyline.fitting_result.empty() || m_config.spiral_mode) {
|
if (!m_config.enable_arc_fitting || path.polyline.fitting_result.empty() || m_config.spiral_mode) {
|
||||||
|
@ -4222,6 +4231,10 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
is_overhang_fan_on = false;
|
is_overhang_fan_on = false;
|
||||||
gcode += ";_OVERHANG_FAN_END\n";
|
gcode += ";_OVERHANG_FAN_END\n";
|
||||||
}
|
}
|
||||||
|
if (is_supp_interface_fan_on) {
|
||||||
|
is_supp_interface_fan_on = false;
|
||||||
|
gcode += ";_SUPP_INTERFACE_FAN_END\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
double last_set_speed = std::max((float)EXTRUDER_CONFIG(slow_down_min_speed), new_points[0].speed) * 60.0;
|
double last_set_speed = std::max((float)EXTRUDER_CONFIG(slow_down_min_speed), new_points[0].speed) * 60.0;
|
||||||
|
@ -4232,7 +4245,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
const ProcessedPoint &processed_point = new_points[i];
|
const ProcessedPoint &processed_point = new_points[i];
|
||||||
Vec2d p = this->point_to_gcode_quantized(processed_point.p);
|
Vec2d p = this->point_to_gcode_quantized(processed_point.p);
|
||||||
const double line_length = (p - prev).norm();
|
const double line_length = (p - prev).norm();
|
||||||
if (m_enable_cooling_markers && enable_overhang_bridge_fan) {
|
if (m_enable_cooling_markers) {
|
||||||
|
if(enable_overhang_bridge_fan) {
|
||||||
if (is_bridge(path.role()) || check_overhang_fan(new_points[i - 1].overlap) ) {
|
if (is_bridge(path.role()) || check_overhang_fan(new_points[i - 1].overlap) ) {
|
||||||
if(!is_overhang_fan_on)
|
if(!is_overhang_fan_on)
|
||||||
gcode += ";_OVERHANG_FAN_START\n";
|
gcode += ";_OVERHANG_FAN_START\n";
|
||||||
|
@ -4242,6 +4256,19 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
gcode += ";_OVERHANG_FAN_END\n";
|
gcode += ";_OVERHANG_FAN_END\n";
|
||||||
is_overhang_fan_on = false;
|
is_overhang_fan_on = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(supp_interface_fan_speed >= 0){
|
||||||
|
if(path.role() == erSupportMaterialInterface) {
|
||||||
|
if(!is_supp_interface_fan_on)
|
||||||
|
gcode += ";_SUPP_INTERFACE_FAN_START\n";
|
||||||
|
is_supp_interface_fan_on = true;
|
||||||
|
} else {
|
||||||
|
if(is_supp_interface_fan_on) {
|
||||||
|
gcode += ";_SUPP_INTERFACE_FAN_END\n";
|
||||||
|
is_supp_interface_fan_on = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4259,6 +4286,10 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
is_overhang_fan_on = false;
|
is_overhang_fan_on = false;
|
||||||
gcode += ";_OVERHANG_FAN_END\n";
|
gcode += ";_OVERHANG_FAN_END\n";
|
||||||
}
|
}
|
||||||
|
if(is_supp_interface_fan_on) {
|
||||||
|
gcode += ";_SUPP_INTERFACE_FAN_END\n";
|
||||||
|
is_supp_interface_fan_on = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (m_enable_cooling_markers) {
|
if (m_enable_cooling_markers) {
|
||||||
gcode += ";_EXTRUDE_END\n";
|
gcode += ";_EXTRUDE_END\n";
|
||||||
|
|
|
@ -61,6 +61,8 @@ struct CoolingLine
|
||||||
TYPE_G2 = 1 << 12,
|
TYPE_G2 = 1 << 12,
|
||||||
TYPE_G3 = 1 << 13,
|
TYPE_G3 = 1 << 13,
|
||||||
TYPE_FORCE_RESUME_FAN = 1 << 14,
|
TYPE_FORCE_RESUME_FAN = 1 << 14,
|
||||||
|
TYPE_SUPPORT_INTERFACE_FAN_START = 1 << 15,
|
||||||
|
TYPE_SUPPORT_INTERFACE_FAN_END = 1 << 16,
|
||||||
};
|
};
|
||||||
|
|
||||||
CoolingLine(unsigned int type, size_t line_start, size_t line_end) :
|
CoolingLine(unsigned int type, size_t line_start, size_t line_end) :
|
||||||
|
@ -479,6 +481,10 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
||||||
line.type = CoolingLine::TYPE_OVERHANG_FAN_START;
|
line.type = CoolingLine::TYPE_OVERHANG_FAN_START;
|
||||||
} else if (boost::starts_with(sline, ";_OVERHANG_FAN_END")) {
|
} else if (boost::starts_with(sline, ";_OVERHANG_FAN_END")) {
|
||||||
line.type = CoolingLine::TYPE_OVERHANG_FAN_END;
|
line.type = CoolingLine::TYPE_OVERHANG_FAN_END;
|
||||||
|
} else if (boost::starts_with(sline, ";_SUPP_INTERFACE_FAN_START")) {
|
||||||
|
line.type = CoolingLine::TYPE_SUPPORT_INTERFACE_FAN_START;
|
||||||
|
} else if (boost::starts_with(sline, ";_SUPP_INTERFACE_FAN_END")) {
|
||||||
|
line.type = CoolingLine::TYPE_SUPPORT_INTERFACE_FAN_END;
|
||||||
} else if (boost::starts_with(sline, "G4 ")) {
|
} else if (boost::starts_with(sline, "G4 ")) {
|
||||||
// Parse the wait time.
|
// Parse the wait time.
|
||||||
line.type = CoolingLine::TYPE_G4;
|
line.type = CoolingLine::TYPE_G4;
|
||||||
|
@ -722,7 +728,9 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||||
new_gcode.reserve(gcode.size() * 2);
|
new_gcode.reserve(gcode.size() * 2);
|
||||||
bool overhang_fan_control= false;
|
bool overhang_fan_control= false;
|
||||||
int overhang_fan_speed = 0;
|
int overhang_fan_speed = 0;
|
||||||
auto change_extruder_set_fan = [ this, layer_id, layer_time, &new_gcode, &overhang_fan_control, &overhang_fan_speed](bool immediately_apply) {
|
bool supp_interface_fan_control= false;
|
||||||
|
int supp_interface_fan_speed = 0;
|
||||||
|
auto change_extruder_set_fan = [ this, layer_id, layer_time, &new_gcode, &overhang_fan_control, &overhang_fan_speed, &supp_interface_fan_control, &supp_interface_fan_speed](bool immediately_apply) {
|
||||||
#define EXTRUDER_CONFIG(OPT) m_config.OPT.get_at(m_current_extruder)
|
#define EXTRUDER_CONFIG(OPT) m_config.OPT.get_at(m_current_extruder)
|
||||||
int fan_min_speed = EXTRUDER_CONFIG(fan_min_speed);
|
int fan_min_speed = EXTRUDER_CONFIG(fan_min_speed);
|
||||||
int fan_speed_new = EXTRUDER_CONFIG(reduce_fan_stop_start_freq) ? fan_min_speed : 0;
|
int fan_speed_new = EXTRUDER_CONFIG(reduce_fan_stop_start_freq) ? fan_min_speed : 0;
|
||||||
|
@ -731,6 +739,8 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||||
int close_fan_the_first_x_layers = EXTRUDER_CONFIG(close_fan_the_first_x_layers);
|
int close_fan_the_first_x_layers = EXTRUDER_CONFIG(close_fan_the_first_x_layers);
|
||||||
// Is the fan speed ramp enabled?
|
// Is the fan speed ramp enabled?
|
||||||
int full_fan_speed_layer = EXTRUDER_CONFIG(full_fan_speed_layer);
|
int full_fan_speed_layer = EXTRUDER_CONFIG(full_fan_speed_layer);
|
||||||
|
supp_interface_fan_speed = EXTRUDER_CONFIG(support_material_interface_fan_speed);
|
||||||
|
|
||||||
if (close_fan_the_first_x_layers <= 0 && full_fan_speed_layer > 0) {
|
if (close_fan_the_first_x_layers <= 0 && full_fan_speed_layer > 0) {
|
||||||
// When ramping up fan speed from close_fan_the_first_x_layers to full_fan_speed_layer, force close_fan_the_first_x_layers above zero,
|
// When ramping up fan speed from close_fan_the_first_x_layers to full_fan_speed_layer, force close_fan_the_first_x_layers above zero,
|
||||||
// so there will be a zero fan speed at least at the 1st layer.
|
// so there will be a zero fan speed at least at the 1st layer.
|
||||||
|
@ -759,6 +769,9 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||||
fan_speed_new = std::clamp(int(float(fan_speed_new) * factor + 0.5f), 0, 255);
|
fan_speed_new = std::clamp(int(float(fan_speed_new) * factor + 0.5f), 0, 255);
|
||||||
overhang_fan_speed = std::clamp(int(float(overhang_fan_speed) * factor + 0.5f), 0, 255);
|
overhang_fan_speed = std::clamp(int(float(overhang_fan_speed) * factor + 0.5f), 0, 255);
|
||||||
}
|
}
|
||||||
|
supp_interface_fan_speed = EXTRUDER_CONFIG(support_material_interface_fan_speed);
|
||||||
|
supp_interface_fan_control = supp_interface_fan_speed >= 0;
|
||||||
|
|
||||||
#undef EXTRUDER_CONFIG
|
#undef EXTRUDER_CONFIG
|
||||||
overhang_fan_control= overhang_fan_speed > fan_speed_new;
|
overhang_fan_control= overhang_fan_speed > fan_speed_new;
|
||||||
} else {
|
} else {
|
||||||
|
@ -766,6 +779,8 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||||
overhang_fan_speed = 0;
|
overhang_fan_speed = 0;
|
||||||
fan_speed_new = 0;
|
fan_speed_new = 0;
|
||||||
additional_fan_speed_new = 0;
|
additional_fan_speed_new = 0;
|
||||||
|
supp_interface_fan_control= false;
|
||||||
|
supp_interface_fan_speed = 0;
|
||||||
}
|
}
|
||||||
if (fan_speed_new != m_fan_speed) {
|
if (fan_speed_new != m_fan_speed) {
|
||||||
m_fan_speed = fan_speed_new;
|
m_fan_speed = fan_speed_new;
|
||||||
|
@ -809,6 +824,16 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||||
m_current_fan_speed = m_fan_speed;
|
m_current_fan_speed = m_fan_speed;
|
||||||
new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_fan_speed);
|
new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_fan_speed);
|
||||||
}
|
}
|
||||||
|
} else if (line->type & CoolingLine::TYPE_SUPPORT_INTERFACE_FAN_START) {
|
||||||
|
if (supp_interface_fan_control) {
|
||||||
|
m_current_fan_speed = supp_interface_fan_speed;
|
||||||
|
new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, supp_interface_fan_speed);
|
||||||
|
}
|
||||||
|
} else if (line->type & CoolingLine::TYPE_SUPPORT_INTERFACE_FAN_END) {
|
||||||
|
if (supp_interface_fan_control) {
|
||||||
|
m_current_fan_speed = m_fan_speed;
|
||||||
|
new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_fan_speed);
|
||||||
|
}
|
||||||
} else if (line->type & CoolingLine::TYPE_FORCE_RESUME_FAN) {
|
} else if (line->type & CoolingLine::TYPE_FORCE_RESUME_FAN) {
|
||||||
//BBS: force to write a fan speed command again
|
//BBS: force to write a fan speed command again
|
||||||
if (m_current_fan_speed != -1)
|
if (m_current_fan_speed != -1)
|
||||||
|
|
|
@ -781,7 +781,7 @@ static std::vector<std::string> s_Preset_filament_options {
|
||||||
"filament_wipe_distance", "additional_cooling_fan_speed",
|
"filament_wipe_distance", "additional_cooling_fan_speed",
|
||||||
"bed_temperature_difference", "nozzle_temperature_range_low", "nozzle_temperature_range_high",
|
"bed_temperature_difference", "nozzle_temperature_range_low", "nozzle_temperature_range_high",
|
||||||
//SoftFever
|
//SoftFever
|
||||||
"enable_pressure_advance", "pressure_advance","chamber_temperature", "filament_shrink"/*,"filament_seam_gap"*/
|
"enable_pressure_advance", "pressure_advance","chamber_temperature", "filament_shrink", "support_material_interface_fan_speed" /*,"filament_seam_gap"*/
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<std::string> s_Preset_machine_limits_options {
|
static std::vector<std::string> s_Preset_machine_limits_options {
|
||||||
|
|
|
@ -166,7 +166,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
||||||
"wipe_on_loops",
|
"wipe_on_loops",
|
||||||
"gcode_comments",
|
"gcode_comments",
|
||||||
"gcode_label_objects",
|
"gcode_label_objects",
|
||||||
"exclude_object"
|
"exclude_object",
|
||||||
|
"support_material_interface_fan_speed"
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unordered_set<std::string> steps_ignore;
|
static std::unordered_set<std::string> steps_ignore;
|
||||||
|
|
|
@ -1660,6 +1660,18 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionInts { 0 });
|
def->set_default_value(new ConfigOptionInts { 0 });
|
||||||
|
|
||||||
|
def = this->add("support_material_interface_fan_speed", coInts);
|
||||||
|
def->label = L("Support interface fan speed");
|
||||||
|
def->tooltip = L("This fan speed is enforced during all support interfaces, to be able to weaken their bonding with a high fan speed."
|
||||||
|
"\nSet to -1 to disable this override."
|
||||||
|
"\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("fuzzy_skin", coEnum);
|
def = this->add("fuzzy_skin", coEnum);
|
||||||
def->label = L("Fuzzy Skin");
|
def->label = L("Fuzzy Skin");
|
||||||
def->category = L("Others");
|
def->category = L("Others");
|
||||||
|
|
|
@ -1011,6 +1011,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||||
((ConfigOptionBool, exclude_object))
|
((ConfigOptionBool, exclude_object))
|
||||||
((ConfigOptionBool, gcode_comments))
|
((ConfigOptionBool, gcode_comments))
|
||||||
((ConfigOptionInt, slow_down_layers))
|
((ConfigOptionInt, slow_down_layers))
|
||||||
|
((ConfigOptionInts, support_material_interface_fan_speed))
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -2759,6 +2759,7 @@ void TabFilament::build()
|
||||||
optgroup->append_single_option_line("enable_overhang_bridge_fan", "auto-cooling");
|
optgroup->append_single_option_line("enable_overhang_bridge_fan", "auto-cooling");
|
||||||
optgroup->append_single_option_line("overhang_fan_threshold", "auto-cooling");
|
optgroup->append_single_option_line("overhang_fan_threshold", "auto-cooling");
|
||||||
optgroup->append_single_option_line("overhang_fan_speed", "auto-cooling");
|
optgroup->append_single_option_line("overhang_fan_speed", "auto-cooling");
|
||||||
|
optgroup->append_single_option_line("support_material_interface_fan_speed");
|
||||||
|
|
||||||
optgroup = page->new_optgroup(L("Auxiliary part cooling fan"), L"param_cooling_fan");
|
optgroup = page->new_optgroup(L("Auxiliary part cooling fan"), L"param_cooling_fan");
|
||||||
optgroup->append_single_option_line("additional_cooling_fan_speed");
|
optgroup->append_single_option_line("additional_cooling_fan_speed");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue