mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 01:50:40 +08:00
Allow for a flag to change scaling from 0-100 from the default of 0-255 for fan output
This commit is contained in:
parent
46cd5689bc
commit
bdda20dca8
@ -1251,6 +1251,7 @@ sub title { 'Printer Settings' }
|
||||
sub options {
|
||||
return qw(
|
||||
bed_shape z_offset z_steps_per_mm has_heatbed
|
||||
fan_percentage
|
||||
gcode_flavor use_relative_e_distances
|
||||
serial_port serial_speed
|
||||
host_type print_host octoprint_apikey
|
||||
@ -1417,6 +1418,7 @@ sub build {
|
||||
$optgroup->append_single_option_line('z_steps_per_mm');
|
||||
$optgroup->append_single_option_line('use_set_and_wait_extruder');
|
||||
$optgroup->append_single_option_line('use_set_and_wait_bed');
|
||||
$optgroup->append_single_option_line('fan_percentage');
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -163,6 +163,7 @@ std::string
|
||||
GCodeWriter::set_fan(unsigned int speed, bool dont_save)
|
||||
{
|
||||
std::ostringstream gcode;
|
||||
const double baseline_factor = (this->config.fan_percentage ? 1.0 : 255.0);
|
||||
if (this->_last_fan_speed != speed || dont_save) {
|
||||
if (!dont_save) this->_last_fan_speed = speed;
|
||||
|
||||
@ -186,7 +187,7 @@ GCodeWriter::set_fan(unsigned int speed, bool dont_save)
|
||||
} else {
|
||||
gcode << "S";
|
||||
}
|
||||
gcode << (255.0 * speed / 100.0);
|
||||
gcode << (baseline_factor * speed / 100.0);
|
||||
}
|
||||
if (this->config.gcode_comments) gcode << " ; enable fan";
|
||||
gcode << "\n";
|
||||
|
@ -429,6 +429,12 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->default_value = opt;
|
||||
}
|
||||
|
||||
def = this->add("fan_percentage", coBool);
|
||||
def->label = __TRANS("Fan PWM from 0-100");
|
||||
def->tooltip = __TRANS("Set this if your printer uses control values from 0-100 instead of 0-255.");
|
||||
def->cli = "fan-percentage";
|
||||
def->default_value = new ConfigOptionBool(false);
|
||||
|
||||
def = this->add("filament_diameter", coFloats);
|
||||
def->label = __TRANS("Diameter");
|
||||
def->tooltip = __TRANS("Enter your filament diameter here. Good precision is required, so use a caliper and do multiple measurements along the filament, then compute the average.");
|
||||
|
@ -331,6 +331,7 @@ class GCodeConfig : public virtual StaticPrintConfig
|
||||
ConfigOptionStrings end_filament_gcode;
|
||||
ConfigOptionString extrusion_axis;
|
||||
ConfigOptionFloats extrusion_multiplier;
|
||||
ConfigOptionBool fan_percentage;
|
||||
ConfigOptionFloats filament_diameter;
|
||||
ConfigOptionFloats filament_density;
|
||||
ConfigOptionFloats filament_cost;
|
||||
@ -375,6 +376,7 @@ class GCodeConfig : public virtual StaticPrintConfig
|
||||
OPT_PTR(end_filament_gcode);
|
||||
OPT_PTR(extrusion_axis);
|
||||
OPT_PTR(extrusion_multiplier);
|
||||
OPT_PTR(fan_percentage);
|
||||
OPT_PTR(filament_diameter);
|
||||
OPT_PTR(filament_density);
|
||||
OPT_PTR(filament_cost);
|
||||
|
Loading…
x
Reference in New Issue
Block a user