temperature override (and move all overrides into "filament" category)

This commit is contained in:
supermerill 2020-08-29 20:32:29 +02:00
parent dd2e3241f8
commit 4e02398f77
7 changed files with 33 additions and 9 deletions

View File

@ -2498,6 +2498,7 @@ void GCode::process_layer(
this->set_origin(unscale(offset)); this->set_origin(unscale(offset));
if (instance_to_print.object_by_extruder.support != nullptr && !print_wipe_extrusions) { if (instance_to_print.object_by_extruder.support != nullptr && !print_wipe_extrusions) {
m_layer = layers[instance_to_print.layer_id].support_layer; m_layer = layers[instance_to_print.layer_id].support_layer;
gcode += m_writer.set_temperature(m_config.temperature.get_at(m_writer.tool()->id()), false, m_writer.tool()->id());
gcode += this->extrude_support( gcode += this->extrude_support(
// support_extrusion_role is erSupportMaterial, erSupportMaterialInterface or erMixed for all extrusion paths. // support_extrusion_role is erSupportMaterial, erSupportMaterialInterface or erMixed for all extrusion paths.
instance_to_print.object_by_extruder.support->chained_path_from(m_last_pos, instance_to_print.object_by_extruder.support_extrusion_role)); instance_to_print.object_by_extruder.support->chained_path_from(m_last_pos, instance_to_print.object_by_extruder.support_extrusion_role));
@ -3738,6 +3739,10 @@ std::string GCode::extrude_perimeters(const Print &print, const std::vector<Obje
if (!region.perimeters.empty()) { if (!region.perimeters.empty()) {
m_config.apply(print.regions()[&region - &by_region.front()]->config()); m_config.apply(print.regions()[&region - &by_region.front()]->config());
m_writer.apply_print_region_config(print.regions()[&region - &by_region.front()]->config()); m_writer.apply_print_region_config(print.regions()[&region - &by_region.front()]->config());
if (m_config.print_temperature > 0)
gcode += m_writer.set_temperature(m_config.print_temperature.value, false, m_writer.tool()->id());
else
gcode += m_writer.set_temperature(m_config.temperature.get_at(m_writer.tool()->id()), false, m_writer.tool()->id());
for (const ExtrusionEntity *ee : region.perimeters) for (const ExtrusionEntity *ee : region.perimeters)
gcode += this->extrude_entity(*ee, "", -1., &lower_layer_edge_grid); gcode += this->extrude_entity(*ee, "", -1., &lower_layer_edge_grid);
} }
@ -3752,6 +3757,10 @@ std::string GCode::extrude_infill(const Print &print, const std::vector<ObjectBy
if (!region.infills.empty() && print.regions()[&region - &by_region.front()]->config().infill_first == is_infill_first) { if (!region.infills.empty() && print.regions()[&region - &by_region.front()]->config().infill_first == is_infill_first) {
m_config.apply(print.regions()[&region - &by_region.front()]->config()); m_config.apply(print.regions()[&region - &by_region.front()]->config());
m_writer.apply_print_region_config(print.regions()[&region - &by_region.front()]->config()); m_writer.apply_print_region_config(print.regions()[&region - &by_region.front()]->config());
if (m_config.print_temperature > 0)
gcode += m_writer.set_temperature(m_config.print_temperature.value, false, m_writer.tool()->id());
else
gcode += m_writer.set_temperature(m_config.temperature.get_at(m_writer.tool()->id()), false, m_writer.tool()->id());
ExtrusionEntitiesPtr extrusions { region.infills }; ExtrusionEntitiesPtr extrusions { region.infills };
chain_and_reorder_extrusion_entities(extrusions, &m_last_pos); chain_and_reorder_extrusion_entities(extrusions, &m_last_pos);
for (const ExtrusionEntity *fill : extrusions) { for (const ExtrusionEntity *fill : extrusions) {

View File

@ -87,8 +87,10 @@ std::string GCodeWriter::postamble() const
return gcode.str(); return gcode.str();
} }
std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool)
{ {
if (m_last_temperature == temperature)
return "";
if (wait && (FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish))) if (wait && (FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)))
return ""; return "";
@ -126,6 +128,8 @@ std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, in
if ((FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepRap)) && wait) if ((FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepRap)) && wait)
gcode << "M116 ; wait for temperature to be reached\n"; gcode << "M116 ; wait for temperature to be reached\n";
m_last_temperature = temperature;
return gcode.str(); return gcode.str();
} }

View File

@ -65,7 +65,7 @@ public:
} }
std::string preamble(); std::string preamble();
std::string postamble() const; std::string postamble() const;
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const; std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1);
std::string set_bed_temperature(unsigned int temperature, bool wait = false); std::string set_bed_temperature(unsigned int temperature, bool wait = false);
std::string set_fan(unsigned int speed, bool dont_save = false); std::string set_fan(unsigned int speed, bool dont_save = false);
void set_acceleration(unsigned int acceleration); void set_acceleration(unsigned int acceleration);
@ -109,6 +109,7 @@ private:
// If set to zero, the limit is not in action. // If set to zero, the limit is not in action.
unsigned int m_max_acceleration; unsigned int m_max_acceleration;
unsigned int m_last_fan_speed; unsigned int m_last_fan_speed;
unsigned int m_last_temperature;
unsigned int m_last_bed_temperature; unsigned int m_last_bed_temperature;
bool m_last_bed_temperature_reached; bool m_last_bed_temperature_reached;
double m_lifted; double m_lifted;

View File

@ -978,7 +978,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("print_extrusion_multiplier", coPercent); def = this->add("print_extrusion_multiplier", coPercent);
def->label = L("Extrusion multiplier"); def->label = L("Extrusion multiplier");
def->category = OptionCategory::width; def->category = OptionCategory::filament;
def->tooltip = L("This factor changes the amount of flow proportionally. You may need to tweak " def->tooltip = L("This factor changes the amount of flow proportionally. You may need to tweak "
"this setting to get nice surface finish and correct single wall widths. " "this setting to get nice surface finish and correct single wall widths. "
"Usual values are between 90% and 110%. If you think you need to change this more, " "Usual values are between 90% and 110%. If you think you need to change this more, "
@ -2494,7 +2494,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("print_retract_length", coFloat); def = this->add("print_retract_length", coFloat);
def->label = L("Retraction length"); def->label = L("Retraction length");
def->category = OptionCategory::width; def->category = OptionCategory::filament;
def->tooltip = L("Override the retract_length settign from the printer config. Used for calibration. Set negative to disable"); def->tooltip = L("Override the retract_length settign from the printer config. Used for calibration. Set negative to disable");
def->mode = comExpert; def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat( -1.f)); def->set_default_value(new ConfigOptionFloat( -1.f));
@ -3211,6 +3211,13 @@ void PrintConfigDef::init_fff_params()
def->max = max_temp; def->max = max_temp;
def->set_default_value(new ConfigOptionInts { 200 }); def->set_default_value(new ConfigOptionInts { 200 });
def = this->add("print_temperature", coInt);
def->label = L("Temperature");
def->category = OptionCategory::filament;
def->tooltip = L("Override the temperature of the extruder. Avoid doing too many changes, it won't stop for cooling/heating. 0 to disable.");
def->mode = comExpert;
def->set_default_value(new ConfigOptionInt(0));
def = this->add("thin_perimeters", coBool); def = this->add("thin_perimeters", coBool);
def->label = L("Overlapping external perimeter"); def->label = L("Overlapping external perimeter");
def->full_label = L("Overlapping external perimeter"); def->full_label = L("Overlapping external perimeter");

View File

@ -689,7 +689,7 @@ public:
ConfigOptionFloatOrPercent solid_infill_extrusion_width; ConfigOptionFloatOrPercent solid_infill_extrusion_width;
ConfigOptionInt solid_infill_every_layers; ConfigOptionInt solid_infill_every_layers;
ConfigOptionFloatOrPercent solid_infill_speed; ConfigOptionFloatOrPercent solid_infill_speed;
// Detect thin walls. ConfigOptionInt print_temperature;
ConfigOptionBool thin_perimeters; ConfigOptionBool thin_perimeters;
ConfigOptionBool thin_perimeters_all; ConfigOptionBool thin_perimeters_all;
ConfigOptionBool thin_walls; ConfigOptionBool thin_walls;
@ -777,6 +777,7 @@ protected:
OPT_PTR(solid_infill_extrusion_width); OPT_PTR(solid_infill_extrusion_width);
OPT_PTR(solid_infill_every_layers); OPT_PTR(solid_infill_every_layers);
OPT_PTR(solid_infill_speed); OPT_PTR(solid_infill_speed);
OPT_PTR(print_temperature);
OPT_PTR(thin_perimeters); OPT_PTR(thin_perimeters);
OPT_PTR(thin_perimeters_all); OPT_PTR(thin_perimeters_all);
OPT_PTR(thin_walls); OPT_PTR(thin_walls);

View File

@ -109,6 +109,7 @@ void fill_CATEGORY_ICON(std::map<OptionCategory, wxBitmap> &CATEGORY_ICON)
CATEGORY_ICON[OptionCategory::hollowing] = create_scaled_bitmap("hollowing"); CATEGORY_ICON[OptionCategory::hollowing] = create_scaled_bitmap("hollowing");
//others //others
CATEGORY_ICON[OptionCategory::milling] = create_scaled_bitmap("milling"); CATEGORY_ICON[OptionCategory::milling] = create_scaled_bitmap("milling");
CATEGORY_ICON[OptionCategory::filament] = create_scaled_bitmap("spool");
} }
ObjectList::ObjectList(wxWindow* parent) : ObjectList::ObjectList(wxWindow* parent) :

View File

@ -540,6 +540,7 @@ const std::vector<std::string>& Preset::print_options()
, "curve_smoothing_angle_concave", , "curve_smoothing_angle_concave",
"print_extrusion_multiplier", "print_extrusion_multiplier",
"print_retract_length", "print_retract_length",
"print_temperature",
"external_perimeter_cut_corners", "external_perimeter_cut_corners",
"external_perimeter_overlap", "external_perimeter_overlap",
"perimeter_bonding", "perimeter_bonding",