From ea29a22cd6faa9dbe91a9e357e2f639263be9df0 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 12 Apr 2018 21:15:23 -0500 Subject: [PATCH] Adds Printer config option to force the use of set-and-wait gcode semantics (if supported by firmware). Fixes #3268 --- lib/Slic3r/GUI/PresetEditor.pm | 3 +++ xs/src/libslic3r/GCodeWriter.cpp | 3 ++- xs/src/libslic3r/PrintConfig.cpp | 13 +++++++++++++ xs/src/libslic3r/PrintConfig.hpp | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index 88cf6af68..39f206134 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -1217,6 +1217,7 @@ sub options { retract_length_toolchange retract_restart_extra_toolchange retract_lift_above retract_lift_below printer_settings_id printer_notes + use_set_and_wait_bed use_set_and_wait_extruder ); } @@ -1369,6 +1370,8 @@ sub build { $optgroup->append_single_option_line('pressure_advance'); $optgroup->append_single_option_line('vibration_limit'); $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'); } } { diff --git a/xs/src/libslic3r/GCodeWriter.cpp b/xs/src/libslic3r/GCodeWriter.cpp index 3bb218547..e4b011412 100644 --- a/xs/src/libslic3r/GCodeWriter.cpp +++ b/xs/src/libslic3r/GCodeWriter.cpp @@ -107,7 +107,7 @@ GCodeWriter::postamble() const std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const { - + wait = this->config.use_set_and_wait_extruder ? true : wait; std::string code, comment; if (wait && FLAVOR_IS_NOT(gcfTeacup) && FLAVOR_IS_NOT(gcfMakerWare) && FLAVOR_IS_NOT(gcfSailfish)) { code = "M109"; @@ -143,6 +143,7 @@ std::string GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait) const { std::string code, comment; + wait = this->config.use_set_and_wait_bed ? true : wait; if (wait && FLAVOR_IS_NOT(gcfTeacup)) { if (FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)) { code = "M109"; diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 1c6069662..142f5b0b3 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -1631,6 +1631,19 @@ PrintConfigDef::PrintConfigDef() def->cli = "use-relative-e-distances!"; def->default_value = new ConfigOptionBool(false); + def = this->add("use_set_and_wait_extruder", coBool); + def->label = "Use Set-and-Wait GCode (Extruder)"; + def->tooltip = "If your firmware supports a set and wait gcode for temperature changes, use it for automatically inserted temperature gcode for all extruders. Does not affect custom gcode."; + def->cli = "use-set-and-wait-extruder!"; + def->default_value = new ConfigOptionBool(false); + + def = this->add("use_set_and_wait_bed", coBool); + def->label = "Use Set-and-Wait GCode (Bed)"; + def->tooltip = "If your firmware supports a set and wait gcode for temperature changes, use it for automatically inserted temperature gcode for the heatbed. Does not affect custom gcode."; + def->cli = "use-set-and-wait-heatbed!"; + def->default_value = new ConfigOptionBool(false); + + def = this->add("use_volumetric_e", coBool); def->label = "Use volumetric E"; def->tooltip = "This experimental setting uses outputs the E values in cubic millimeters instead of linear millimeters. If your firmware doesn't already know filament diameter(s), you can put commands like 'M200 D[filament_diameter_0] T0' in your start G-code in order to turn volumetric mode on and use the filament diameter associated to the filament selected in Slic3r. This is only supported in recent Marlin."; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index f989c5f52..4b99924cb 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -349,6 +349,8 @@ class GCodeConfig : public virtual StaticPrintConfig ConfigOptionBool use_firmware_retraction; ConfigOptionBool use_relative_e_distances; ConfigOptionBool use_volumetric_e; + ConfigOptionBool use_set_and_wait_extruder; + ConfigOptionBool use_set_and_wait_bed; GCodeConfig(bool initialize = true) : StaticPrintConfig() { if (initialize) @@ -390,6 +392,8 @@ class GCodeConfig : public virtual StaticPrintConfig OPT_PTR(use_firmware_retraction); OPT_PTR(use_relative_e_distances); OPT_PTR(use_volumetric_e); + OPT_PTR(use_set_and_wait_extruder); + OPT_PTR(use_set_and_wait_bed); return NULL; };