new setting: top fan speed

This commit is contained in:
supermerill 2018-06-26 20:01:37 +02:00
parent 436bdac624
commit 2358d41162
7 changed files with 52 additions and 12 deletions

View File

@ -2248,6 +2248,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
if (m_enable_cooling_markers) {
if (is_bridge(path.role()))
gcode += ";_BRIDGE_FAN_START\n";
else if (ExtrusionRole::erTopSolidInfill == path.role())
gcode += ";_TOP_FAN_START\n";
else
comment = ";_EXTRUDE_SET_SPEED";
if (path.role() == erExternalPerimeter)
@ -2269,7 +2271,13 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
}
}
if (m_enable_cooling_markers)
gcode += is_bridge(path.role()) ? ";_BRIDGE_FAN_END\n" : ";_EXTRUDE_END\n";
if (is_bridge(path.role()))
gcode += ";_BRIDGE_FAN_END\n";
else if (ExtrusionRole::erTopSolidInfill == path.role())
gcode += ";_TOP_FAN_END\n";
else
gcode += ";_EXTRUDE_END\n";
this->set_last_pos(path.last_point());
return gcode;

View File

@ -37,15 +37,17 @@ struct CoolingLine
TYPE_EXTRUDE_END = 1 << 1,
TYPE_BRIDGE_FAN_START = 1 << 2,
TYPE_BRIDGE_FAN_END = 1 << 3,
TYPE_G0 = 1 << 4,
TYPE_G1 = 1 << 5,
TYPE_ADJUSTABLE = 1 << 6,
TYPE_EXTERNAL_PERIMETER = 1 << 7,
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,
// The line sets a feedrate.
TYPE_HAS_F = 1 << 8,
TYPE_WIPE = 1 << 9,
TYPE_G4 = 1 << 10,
TYPE_G92 = 1 << 11,
TYPE_HAS_F = 1 << 10,
TYPE_WIPE = 1 << 11,
TYPE_G4 = 1 << 12,
TYPE_G92 = 1 << 13,
};
CoolingLine(unsigned int type, size_t line_start, size_t line_end) :
@ -369,6 +371,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, ";_TOP_FAN_START")) {
line.type = CoolingLine::TYPE_TOP_FAN_START;
} else if (boost::starts_with(sline, ";_TOP_FAN_END")) {
line.type = CoolingLine::TYPE_TOP_FAN_END;
} else if (boost::starts_with(sline, "G4 ")) {
// Parse the wait time.
line.type = CoolingLine::TYPE_G4;
@ -609,8 +615,10 @@ std::string CoolingBuffer::apply_layer_cooldown(
new_gcode.reserve(gcode.size() * 2);
int fan_speed = -1;
bool bridge_fan_control = false;
int bridge_fan_speed = 0;
auto change_extruder_set_fan = [ this, layer_id, layer_time, &new_gcode, &fan_speed, &bridge_fan_control, &bridge_fan_speed ]() {
int bridge_fan_speed = 0;
bool top_fan_control = false;
int top_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]() {
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);
@ -631,11 +639,15 @@ std::string CoolingBuffer::apply_layer_cooldown(
}
}
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;
} else {
bridge_fan_control = false;
bridge_fan_speed = 0;
top_fan_control = false;
top_fan_speed = 0;
fan_speed_new = 0;
}
if (fan_speed_new != fan_speed) {
@ -666,6 +678,12 @@ std::string CoolingBuffer::apply_layer_cooldown(
} else if (line->type & CoolingLine::TYPE_BRIDGE_FAN_END) {
if (bridge_fan_control)
new_gcode += m_gcodegen.writer().set_fan(fan_speed, true);
} else if (line->type & CoolingLine::TYPE_TOP_FAN_START) {
if (top_fan_control)
new_gcode += m_gcodegen.writer().set_fan(top_fan_speed, true);
} else if (line->type & CoolingLine::TYPE_TOP_FAN_END) {
if (top_fan_control)
new_gcode += m_gcodegen.writer().set_fan(fan_speed, true);
} else if (line->type & CoolingLine::TYPE_EXTRUDE_END) {
// Just remove this comment.
} else if (line->type & (CoolingLine::TYPE_ADJUSTABLE | CoolingLine::TYPE_EXTERNAL_PERIMETER | CoolingLine::TYPE_WIPE | CoolingLine::TYPE_HAS_F)) {

View File

@ -89,6 +89,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
"between_objects_gcode",
"bridge_acceleration",
"bridge_fan_speed",
"top_fan_speed",
"cooling",
"default_acceleration",
"deretract_speed",

View File

@ -102,6 +102,15 @@ PrintConfigDef::PrintConfigDef()
def->max = 100;
def->default_value = new ConfigOptionInts{ 100 };
def = this->add("top_fan_speed", coInts);
def->label = L("Top fan speed");
def->tooltip = L("This fan speed is enforced during all top fills.");
def->sidetext = L("%");
def->cli = "top-fan-speed=i@";
def->min = 0;
def->max = 100;
def->default_value = new ConfigOptionInts{ 100 };
def = this->add("bridge_flow_ratio", coFloat);
def->label = L("Bridge flow ratio");
def->category = L("Advanced");

View File

@ -590,6 +590,7 @@ public:
ConfigOptionInts bed_temperature;
ConfigOptionFloat bridge_acceleration;
ConfigOptionInts bridge_fan_speed;
ConfigOptionInts top_fan_speed;
ConfigOptionFloat brim_width;
ConfigOptionBool complete_objects;
ConfigOptionBools cooling;
@ -659,6 +660,7 @@ protected:
OPT_PTR(bed_temperature);
OPT_PTR(bridge_acceleration);
OPT_PTR(bridge_fan_speed);
OPT_PTR(top_fan_speed);
OPT_PTR(brim_width);
OPT_PTR(complete_objects);
OPT_PTR(cooling);

View File

@ -310,7 +310,8 @@ const std::vector<std::string>& Preset::filament_options()
"filament_colour", "filament_diameter", "filament_type", "filament_soluble", "filament_notes", "filament_max_volumetric_speed",
"extrusion_multiplier", "filament_density", "filament_cost", "filament_loading_speed", "filament_unloading_speed", "filament_toolchange_delay",
"filament_ramming_parameters", "temperature", "first_layer_temperature", "bed_temperature",
"first_layer_bed_temperature", "fan_always_on", "cooling", "min_fan_speed", "max_fan_speed", "bridge_fan_speed", "disable_fan_first_layers",
"first_layer_bed_temperature", "fan_always_on", "cooling", "min_fan_speed", "max_fan_speed", "bridge_fan_speed", "top_fan_speed",
"disable_fan_first_layers",
"fan_below_layer_time", "slowdown_below_layer_time", "min_print_speed", "start_filament_gcode", "end_filament_gcode","compatible_printers",
"compatible_printers_condition", "inherits"
};

View File

@ -1303,6 +1303,7 @@ void TabFilament::build()
optgroup->append_line(line);
optgroup->append_single_option_line("bridge_fan_speed");
optgroup->append_single_option_line("top_fan_speed");
optgroup->append_single_option_line("disable_fan_first_layers");
optgroup = page->new_optgroup(_(L("Cooling thresholds")), 250);