From 32dc1672771cea73112f8555088cb3a05b4285f4 Mon Sep 17 00:00:00 2001 From: Morton Jonuschat Date: Mon, 6 Mar 2023 20:41:36 -0800 Subject: [PATCH 1/7] [FEATURE] Chamber temperature config option (PR #10649 from @mjonuschat) --- src/libslic3r/Preset.cpp | 4 +++- src/libslic3r/Print.cpp | 1 + src/libslic3r/PrintConfig.cpp | 10 ++++++++++ src/libslic3r/PrintConfig.hpp | 1 + src/slic3r/GUI/Tab.cpp | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index a7361c0130..55f29f2e34 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -490,7 +490,9 @@ static std::vector s_Preset_filament_options { "filament_retract_layer_change", "filament_wipe", "filament_retract_before_wipe", "filament_retract_length_toolchange", "filament_retract_restart_extra_toolchange", "filament_travel_ramping_lift", "filament_travel_slope", "filament_travel_max_lift", "filament_travel_lift_before_obstacle", // Profile compatibility - "filament_vendor", "compatible_prints", "compatible_prints_condition", "compatible_printers", "compatible_printers_condition", "inherits" + "filament_vendor", "compatible_prints", "compatible_prints_condition", "compatible_printers", "compatible_printers_condition", "inherits", + // SuperSlicer + "chamber_temperature", }; static std::vector s_Preset_machine_limits_options { diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 146994c201..20043bad54 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -94,6 +94,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "overhang_fan_speed_1", "overhang_fan_speed_2", "overhang_fan_speed_3", + "chamber_temperature", "colorprint_heights", "cooling", "default_acceleration", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 3e832eef10..fece15c791 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -496,6 +496,16 @@ void PrintConfigDef::init_fff_params() def->max = 300; def->set_default_value(new ConfigOptionInts { 0 }); + def = this->add("chamber_temperature", coInts); + def->label = L("Chamber"); + def->full_label = L("Chamber temperature"); + def->tooltip = L("Chamber temperature. Note that this setting doesn't do anything, but you can access it in Start G-code, Tool change G-code and the other ones, like for other temperature settings."); + def->sidetext = L("°C"); + def->min = 0; + def->max = 300; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInts{ 0 }); + def = this->add("before_layer_gcode", coString); def->label = L("Before layer change G-code"); def->tooltip = L("This custom code is inserted at every layer change, right before the Z move. " diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 067f8fefda..29d85b4a3e 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -896,6 +896,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloats, wiping_volumes_matrix)) ((ConfigOptionBool, wiping_volumes_use_custom_matrix)) ((ConfigOptionFloat, z_offset)) + ((ConfigOptionInts, chamber_temperature)) ) PRINT_CONFIG_CLASS_DERIVED_DEFINE0( diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 37a6120d15..7e6ceac849 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2167,6 +2167,7 @@ void TabFilament::build() optgroup = page->new_optgroup(L("Temperature")); create_line_with_near_label_widget(optgroup, "idle_temperature"); + optgroup->append_single_option_line("chamber_temperature"); Line line = { L("Nozzle"), "" }; line.append_option(optgroup->get_option("first_layer_temperature")); From 126de4d648fd1964fb3fcc2303f09d7b207f6bec Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 26 Mar 2024 10:56:41 +0100 Subject: [PATCH 2/7] Chamber temperature G-code emission --- src/libslic3r/GCode.cpp | 30 +++++++++++++++++++++++++++-- src/libslic3r/GCode.hpp | 1 + src/libslic3r/GCode/GCodeWriter.cpp | 21 ++++++++++++++++++++ src/libslic3r/GCode/GCodeWriter.hpp | 1 + 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 6a7f825815..ed7bd86c64 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1211,9 +1211,9 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail DoExport::init_ooze_prevention(print, m_ooze_prevention); std::string start_gcode = this->placeholder_parser_process("start_gcode", print.config().start_gcode.value, initial_extruder_id); - // Set bed temperature if the start G-code does not contain any bed temp control G-codes. + + this->_print_first_layer_chamber_temperature(file, print, start_gcode, initial_extruder_id, false); this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, true); - // Set extruder(s) temperature before and after start G-code. this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, false); // adds tag for processor @@ -1223,6 +1223,7 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail file.writeln(start_gcode); this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, true); + this->_print_first_layer_chamber_temperature(file, print, start_gcode, initial_extruder_id, true); print.throw_if_canceled(); // Set other general things. @@ -1889,6 +1890,31 @@ void GCodeGenerator::_print_first_layer_bed_temperature(GCodeOutputStream &file, file.write(set_temp_gcode); } + + +// Write chamber temperatures into the G-code. +// Only do that if the start G-code does not already contain any M-code controlling chamber temperature. +// M141 - Set chamber Temperature +// M191 - Set chamber Temperature and Wait +void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait) +{ + bool autoemit = print.config().autoemit_temperature_commands; + // Initial bed temperature based on the first extruder. + int temp = print.config().chamber_temperature.get_at(first_printing_extruder_id); + // Is the bed temperature set by the provided custom G-code? + int temp_by_gcode = -1; + bool temp_set_by_gcode = custom_gcode_sets_temperature(gcode, 141, 191, false, temp_by_gcode); + if (autoemit && temp_set_by_gcode && temp_by_gcode >= 0 && temp_by_gcode < 1000) + temp = temp_by_gcode; + // Always call m_writer.set_bed_temperature() so it will set the internal "current" state of the bed temp as if + // the custom start G-code emited these. + std::string set_temp_gcode = m_writer.set_chamber_temperature(temp, wait); + if (autoemit && ! temp_set_by_gcode) + file.write(set_temp_gcode); +} + + + // Write 1st layer extruder temperatures into the G-code. // Only do that if the start G-code does not already contain any M-code controlling an extruder temperature. // M104 - Set Extruder Temperature diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 3aa59fb286..7f5020af1e 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -468,6 +468,7 @@ private: std::string _extrude( const ExtrusionAttributes &attribs, const Geometry::ArcWelder::Path &path, const std::string_view description, double speed = -1); void print_machine_envelope(GCodeOutputStream &file, const Print &print); + void _print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); void _print_first_layer_bed_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); // On the first printing layer. This flag triggers first layer speeds. diff --git a/src/libslic3r/GCode/GCodeWriter.cpp b/src/libslic3r/GCode/GCodeWriter.cpp index 2d3b3f798e..95166c143a 100644 --- a/src/libslic3r/GCode/GCodeWriter.cpp +++ b/src/libslic3r/GCode/GCodeWriter.cpp @@ -181,6 +181,27 @@ std::string GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait return gcode.str(); } + + +std::string GCodeWriter::set_chamber_temperature(unsigned int temperature, bool wait) const +{ + std::string_view code, comment; + if (wait) { + code = "M191"sv; + comment = "set chamber temperature and wait for it to be reached"sv; + } else { + code = "M141"sv; + comment = "set chamber temperature"sv; + } + + std::ostringstream gcode; + gcode << code << " S" << temperature << " ; " << comment << "\n"; + + return gcode.str(); +} + + + std::string GCodeWriter::set_acceleration_internal(Acceleration type, unsigned int acceleration) { // Clamp the acceleration to the allowed maximum. diff --git a/src/libslic3r/GCode/GCodeWriter.hpp b/src/libslic3r/GCode/GCodeWriter.hpp index e0b18c4f8e..dcb2e00ea9 100644 --- a/src/libslic3r/GCode/GCodeWriter.hpp +++ b/src/libslic3r/GCode/GCodeWriter.hpp @@ -52,6 +52,7 @@ public: std::string postamble() const; std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const; std::string set_bed_temperature(unsigned int temperature, bool wait = false); + std::string set_chamber_temperature(unsigned int temperature, bool wait) const; std::string set_print_acceleration(unsigned int acceleration) { return set_acceleration_internal(Acceleration::Print, acceleration); } std::string set_travel_acceleration(unsigned int acceleration) { return set_acceleration_internal(Acceleration::Travel, acceleration); } std::string reset_e(bool force = false); From 30e2e20475c9c92288e5aad4bb4778df8b47ed72 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 26 Mar 2024 09:26:22 +0100 Subject: [PATCH 3/7] Added chamber_minimal_temperature parameter --- src/libslic3r/Preset.cpp | 6 ++---- src/libslic3r/Print.cpp | 1 + src/libslic3r/PrintConfig.cpp | 12 +++++++++++- src/libslic3r/PrintConfig.hpp | 3 ++- src/slic3r/GUI/Tab.cpp | 6 +++++- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 55f29f2e34..046334058e 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -483,16 +483,14 @@ static std::vector s_Preset_filament_options { "filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow", "temperature", "idle_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", "full_fan_speed_layer", "fan_below_layer_time", "slowdown_below_layer_time", "min_print_speed", - "start_filament_gcode", "end_filament_gcode", "enable_dynamic_fan_speeds", + "start_filament_gcode", "end_filament_gcode", "enable_dynamic_fan_speeds", "chamber_temperature", "chamber_minimal_temperature", "overhang_fan_speed_0", "overhang_fan_speed_1", "overhang_fan_speed_2", "overhang_fan_speed_3", // Retract overrides "filament_retract_length", "filament_retract_lift", "filament_retract_lift_above", "filament_retract_lift_below", "filament_retract_speed", "filament_deretract_speed", "filament_retract_restart_extra", "filament_retract_before_travel", "filament_retract_layer_change", "filament_wipe", "filament_retract_before_wipe", "filament_retract_length_toolchange", "filament_retract_restart_extra_toolchange", "filament_travel_ramping_lift", "filament_travel_slope", "filament_travel_max_lift", "filament_travel_lift_before_obstacle", // Profile compatibility - "filament_vendor", "compatible_prints", "compatible_prints_condition", "compatible_printers", "compatible_printers_condition", "inherits", - // SuperSlicer - "chamber_temperature", + "filament_vendor", "compatible_prints", "compatible_prints_condition", "compatible_printers", "compatible_printers_condition", "inherits" }; static std::vector s_Preset_machine_limits_options { diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 20043bad54..e7d223cbd0 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -95,6 +95,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "overhang_fan_speed_2", "overhang_fan_speed_3", "chamber_temperature", + "chamber_minimal_temperature", "colorprint_heights", "cooling", "default_acceleration", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index fece15c791..7f3fdc4ce9 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -497,7 +497,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionInts { 0 }); def = this->add("chamber_temperature", coInts); - def->label = L("Chamber"); + def->label = L("Nominal"); def->full_label = L("Chamber temperature"); def->tooltip = L("Chamber temperature. Note that this setting doesn't do anything, but you can access it in Start G-code, Tool change G-code and the other ones, like for other temperature settings."); def->sidetext = L("°C"); @@ -506,6 +506,16 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionInts{ 0 }); + def = this->add("chamber_minimal_temperature", coInts); + def->label = L("Minimal"); + def->full_label = L("Chamber minimal temperature"); + def->tooltip = L("Chamber temperature. Note that this setting doesn't do anything, but you can access it in Start G-code, Tool change G-code and the other ones, like for other temperature settings."); + def->sidetext = L("°C"); + def->min = 0; + def->max = 300; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInts{ 0 }); + def = this->add("before_layer_gcode", coString); def->label = L("Before layer change G-code"); def->tooltip = L("This custom code is inserted at every layer change, right before the Z move. " diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 29d85b4a3e..72ba652e5f 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -820,6 +820,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionInts, overhang_fan_speed_1)) ((ConfigOptionInts, overhang_fan_speed_2)) ((ConfigOptionInts, overhang_fan_speed_3)) + ((ConfigOptionInts, chamber_temperature)) + ((ConfigOptionInts, chamber_minimal_temperature)) ((ConfigOptionBool, complete_objects)) ((ConfigOptionFloats, colorprint_heights)) ((ConfigOptionBools, cooling)) @@ -896,7 +898,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloats, wiping_volumes_matrix)) ((ConfigOptionBool, wiping_volumes_use_custom_matrix)) ((ConfigOptionFloat, z_offset)) - ((ConfigOptionInts, chamber_temperature)) ) PRINT_CONFIG_CLASS_DERIVED_DEFINE0( diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 7e6ceac849..fdf0d3a339 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2167,7 +2167,6 @@ void TabFilament::build() optgroup = page->new_optgroup(L("Temperature")); create_line_with_near_label_widget(optgroup, "idle_temperature"); - optgroup->append_single_option_line("chamber_temperature"); Line line = { L("Nozzle"), "" }; line.append_option(optgroup->get_option("first_layer_temperature")); @@ -2179,6 +2178,11 @@ void TabFilament::build() line.append_option(optgroup->get_option("bed_temperature")); optgroup->append_line(line); + line = { L("Chamber"), "" }; + line.append_option(optgroup->get_option("chamber_temperature")); + line.append_option(optgroup->get_option("chamber_minimal_temperature")); + optgroup->append_line(line); + page = add_options_page(L("Cooling"), "cooling"); std::string category_path = "cooling_127569#"; optgroup = page->new_optgroup(L("Enable")); From 8d26de63f3b00184b0627417ef409576e25b6a82 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 26 Mar 2024 11:16:31 +0100 Subject: [PATCH 4/7] The new chamber_minimal_temperature parameter is taken into account --- src/libslic3r/GCode.cpp | 11 +++++------ src/libslic3r/GCode.hpp | 2 +- src/libslic3r/GCode/GCodeWriter.cpp | 4 ++-- src/libslic3r/GCode/GCodeWriter.hpp | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index ed7bd86c64..e2254aeedd 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1212,7 +1212,7 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail std::string start_gcode = this->placeholder_parser_process("start_gcode", print.config().start_gcode.value, initial_extruder_id); - this->_print_first_layer_chamber_temperature(file, print, start_gcode, initial_extruder_id, false); + this->_print_first_layer_chamber_temperature(file, print, start_gcode, config().chamber_temperature.get_at(initial_extruder_id), false, false); this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, true); this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, false); @@ -1223,7 +1223,8 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail file.writeln(start_gcode); this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, true); - this->_print_first_layer_chamber_temperature(file, print, start_gcode, initial_extruder_id, true); + this->_print_first_layer_chamber_temperature(file, print, start_gcode, config().chamber_minimal_temperature.get_at(initial_extruder_id), true, false); + this->_print_first_layer_chamber_temperature(file, print, start_gcode, config().chamber_temperature.get_at(initial_extruder_id), false, false); print.throw_if_canceled(); // Set other general things. @@ -1896,11 +1897,9 @@ void GCodeGenerator::_print_first_layer_bed_temperature(GCodeOutputStream &file, // Only do that if the start G-code does not already contain any M-code controlling chamber temperature. // M141 - Set chamber Temperature // M191 - Set chamber Temperature and Wait -void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait) +void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, int temp, bool wait, bool accurate) { bool autoemit = print.config().autoemit_temperature_commands; - // Initial bed temperature based on the first extruder. - int temp = print.config().chamber_temperature.get_at(first_printing_extruder_id); // Is the bed temperature set by the provided custom G-code? int temp_by_gcode = -1; bool temp_set_by_gcode = custom_gcode_sets_temperature(gcode, 141, 191, false, temp_by_gcode); @@ -1908,7 +1907,7 @@ void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &f temp = temp_by_gcode; // Always call m_writer.set_bed_temperature() so it will set the internal "current" state of the bed temp as if // the custom start G-code emited these. - std::string set_temp_gcode = m_writer.set_chamber_temperature(temp, wait); + std::string set_temp_gcode = m_writer.set_chamber_temperature(temp, wait, accurate); if (autoemit && ! temp_set_by_gcode) file.write(set_temp_gcode); } diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 7f5020af1e..e25a2421e6 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -468,7 +468,7 @@ private: std::string _extrude( const ExtrusionAttributes &attribs, const Geometry::ArcWelder::Path &path, const std::string_view description, double speed = -1); void print_machine_envelope(GCodeOutputStream &file, const Print &print); - void _print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); + void _print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, int temp, bool wait, bool accurate); void _print_first_layer_bed_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); // On the first printing layer. This flag triggers first layer speeds. diff --git a/src/libslic3r/GCode/GCodeWriter.cpp b/src/libslic3r/GCode/GCodeWriter.cpp index 95166c143a..270b576454 100644 --- a/src/libslic3r/GCode/GCodeWriter.cpp +++ b/src/libslic3r/GCode/GCodeWriter.cpp @@ -183,7 +183,7 @@ std::string GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait -std::string GCodeWriter::set_chamber_temperature(unsigned int temperature, bool wait) const +std::string GCodeWriter::set_chamber_temperature(unsigned int temperature, bool wait, bool accurate) const { std::string_view code, comment; if (wait) { @@ -195,7 +195,7 @@ std::string GCodeWriter::set_chamber_temperature(unsigned int temperature, bool } std::ostringstream gcode; - gcode << code << " S" << temperature << " ; " << comment << "\n"; + gcode << code << (accurate ? " R" : " S") << temperature << " ; " << comment << "\n"; return gcode.str(); } diff --git a/src/libslic3r/GCode/GCodeWriter.hpp b/src/libslic3r/GCode/GCodeWriter.hpp index dcb2e00ea9..42b0da4537 100644 --- a/src/libslic3r/GCode/GCodeWriter.hpp +++ b/src/libslic3r/GCode/GCodeWriter.hpp @@ -52,7 +52,7 @@ public: std::string postamble() const; std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const; std::string set_bed_temperature(unsigned int temperature, bool wait = false); - std::string set_chamber_temperature(unsigned int temperature, bool wait) const; + std::string set_chamber_temperature(unsigned int temperature, bool wait, bool accurate) const; std::string set_print_acceleration(unsigned int acceleration) { return set_acceleration_internal(Acceleration::Print, acceleration); } std::string set_travel_acceleration(unsigned int acceleration) { return set_acceleration_internal(Acceleration::Travel, acceleration); } std::string reset_e(bool force = false); From 7e3e2b577b4ff1a0aa471a07f089d168237121ec Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 26 Mar 2024 13:26:56 +0100 Subject: [PATCH 5/7] Added heated_chamber checkbox into Printer Settings --- src/libslic3r/GCode.cpp | 2 ++ src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 9 +++++++++ src/libslic3r/PrintConfig.hpp | 1 + src/slic3r/GUI/Tab.cpp | 8 ++++++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index e2254aeedd..06afed6c18 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1899,6 +1899,8 @@ void GCodeGenerator::_print_first_layer_bed_temperature(GCodeOutputStream &file, // M191 - Set chamber Temperature and Wait void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, int temp, bool wait, bool accurate) { + if (! print.config().heated_chamber) + return; bool autoemit = print.config().autoemit_temperature_commands; // Is the bed temperature set by the provided custom G-code? int temp_by_gcode = -1; diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 046334058e..1718f8eaea 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -512,7 +512,7 @@ static std::vector s_Preset_printer_options { "between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction", "cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "multimaterial_purging", "max_print_height", "default_print_profile", "inherits", - "remaining_times", "silent_mode", + "remaining_times", "silent_mode", "heated_chamber", "machine_limits_usage", "thumbnails", "thumbnails_format" }; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 7f3fdc4ce9..8ccf96e698 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1856,6 +1856,15 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionString("")); + def = this->add("heated_chamber", coBool); + def->label = L("Supports heated chamber"); + def->tooltip = L("When enabled, G-codes to heat up the chamber will be emitted before and after the Start G-code (unless they are " + "explicitely used in the Start G-code).\n\nThe temperature can be configured in Filament Settings, " + "temperature for the first printing filament will be used. The chamber heating is not turned off " + "at the end, the user is supposed to do it in custom End G-code when they want it."); + def->mode = comExpert; + def->set_default_value(new ConfigOptionBool(false)); + def = this->add("remaining_times", coBool); def->label = L("Supports remaining times"); def->tooltip = L("Emit M73 P[percent printed] R[remaining time in minutes] at 1 minute" diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 72ba652e5f..323eaf96af 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -790,6 +790,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, parking_pos_retraction)) ((ConfigOptionBool, remaining_times)) ((ConfigOptionBool, silent_mode)) + ((ConfigOptionBool, heated_chamber)) ((ConfigOptionFloat, extra_loading_move)) ((ConfigOptionFloat, multimaterial_purging)) ((ConfigOptionString, color_change_gcode)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index fdf0d3a339..dfd7f6c301 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2385,6 +2385,13 @@ void TabFilament::toggle_options() } } + if (m_active_page->title() == "Filament") + { + bool supports_chamber = m_preset_bundle->printers.get_edited_preset().config.opt_bool("heated_chamber"); + toggle_option("chamber_temperature", supports_chamber); + toggle_option("chamber_minimal_temperature", supports_chamber); + } + if (m_active_page->title() == "Advanced") { bool multitool_ramming = m_config->opt_bool("filament_multitool_ramming", 0); @@ -2696,6 +2703,7 @@ void TabPrinter::build_fff() optgroup->append_single_option_line("silent_mode"); optgroup->append_single_option_line("remaining_times"); optgroup->append_single_option_line("binary_gcode"); + optgroup->append_single_option_line("heated_chamber"); optgroup->on_change = [this](t_config_option_key opt_key, boost::any value) { wxTheApp->CallAfter([this, opt_key, value]() { From 686e1c54bcf63fa5cf77bdd3ecbbf8d2bbf2eda1 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 26 Mar 2024 13:27:12 +0100 Subject: [PATCH 6/7] Updated tooltips --- src/libslic3r/PrintConfig.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 8ccf96e698..6c206955f2 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -499,20 +499,21 @@ void PrintConfigDef::init_fff_params() def = this->add("chamber_temperature", coInts); def->label = L("Nominal"); def->full_label = L("Chamber temperature"); - def->tooltip = L("Chamber temperature. Note that this setting doesn't do anything, but you can access it in Start G-code, Tool change G-code and the other ones, like for other temperature settings."); + def->tooltip = L("Required chamber temperature for the print. Only used when heated chamber is supported by the printer."); def->sidetext = L("°C"); def->min = 0; - def->max = 300; + def->max = 1000; def->mode = comExpert; def->set_default_value(new ConfigOptionInts{ 0 }); def = this->add("chamber_minimal_temperature", coInts); def->label = L("Minimal"); def->full_label = L("Chamber minimal temperature"); - def->tooltip = L("Chamber temperature. Note that this setting doesn't do anything, but you can access it in Start G-code, Tool change G-code and the other ones, like for other temperature settings."); + def->tooltip = L("Minimal chamber temperature that the printer should wait for before the print starts. This allows " + "to start the print before the nominal chamber temperature is reached."); def->sidetext = L("°C"); def->min = 0; - def->max = 300; + def->max = 1000; def->mode = comExpert; def->set_default_value(new ConfigOptionInts{ 0 }); @@ -2725,16 +2726,17 @@ void PrintConfigDef::init_fff_params() def = this->add("autoemit_temperature_commands", coBool); def->label = L("Emit temperature commands automatically"); - def->tooltip = L("When enabled, PrusaSlicer will check whether your Custom Start G-Code contains M104 or M190. " + def->tooltip = L("When enabled, PrusaSlicer will check whether your custom Start G-Code contains G-codes to set " + "extruder, bed or chamber temperature (M104, M109, M140, M190, M141 and M191). " "If so, the temperatures will not be emitted automatically so you're free to customize " "the order of heating commands and other custom actions. Note that you can use " "placeholder variables for all PrusaSlicer settings, so you can put " "a \"M109 S[first_layer_temperature]\" command wherever you want.\n" - "If your Custom Start G-Code does NOT contain M104 or M190, " - "PrusaSlicer will execute the Start G-Code after bed reached its target temperature " - "and extruder just started heating.\n\n" - "When disabled, PrusaSlicer will NOT emit commands to heat up extruder and bed, " - "leaving both to Custom Start G-Code."); + "If your custom Start G-Code does NOT contain these G-codes, " + "PrusaSlicer will execute the Start G-Code after heated chamber was set to its temperature, " + "bed reached its target temperature and extruder just started heating.\n\n" + "When disabled, PrusaSlicer will NOT emit commands to heat up extruder, bed or chamber, " + "leaving all to Custom Start G-Code."); def->mode = comExpert; def->set_default_value(new ConfigOptionBool(true)); From f881526dc2ea043b219685699d44c2ba482dd906 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 30 Apr 2024 14:02:12 +0200 Subject: [PATCH 7/7] Remove the checkbox in Printer Settings. The feature will be turned off by setting zero, so it is consistent with bed temperature. --- src/libslic3r/GCode.cpp | 2 +- src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 17 +++++------------ src/libslic3r/PrintConfig.hpp | 1 - src/slic3r/GUI/Tab.cpp | 8 -------- 5 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 06afed6c18..365689a777 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1899,7 +1899,7 @@ void GCodeGenerator::_print_first_layer_bed_temperature(GCodeOutputStream &file, // M191 - Set chamber Temperature and Wait void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, int temp, bool wait, bool accurate) { - if (! print.config().heated_chamber) + if (temp == 0) return; bool autoemit = print.config().autoemit_temperature_commands; // Is the bed temperature set by the provided custom G-code? diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 1718f8eaea..046334058e 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -512,7 +512,7 @@ static std::vector s_Preset_printer_options { "between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction", "cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "multimaterial_purging", "max_print_height", "default_print_profile", "inherits", - "remaining_times", "silent_mode", "heated_chamber", + "remaining_times", "silent_mode", "machine_limits_usage", "thumbnails", "thumbnails_format" }; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 6c206955f2..632a48fdcc 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -499,7 +499,8 @@ void PrintConfigDef::init_fff_params() def = this->add("chamber_temperature", coInts); def->label = L("Nominal"); def->full_label = L("Chamber temperature"); - def->tooltip = L("Required chamber temperature for the print. Only used when heated chamber is supported by the printer."); + def->tooltip = L("Required chamber temperature for the print.\nWhen set to zero, " + "the nominal chamber temperature is not set in the G-code."); def->sidetext = L("°C"); def->min = 0; def->max = 1000; @@ -509,8 +510,9 @@ void PrintConfigDef::init_fff_params() def = this->add("chamber_minimal_temperature", coInts); def->label = L("Minimal"); def->full_label = L("Chamber minimal temperature"); - def->tooltip = L("Minimal chamber temperature that the printer should wait for before the print starts. This allows " - "to start the print before the nominal chamber temperature is reached."); + def->tooltip = L("Minimal chamber temperature that the printer waits for before the print starts. This allows " + "to start the print before the nominal chamber temperature is reached.\nWhen set to zero, " + "the minimal chamber temperature is not set in the G-code."); def->sidetext = L("°C"); def->min = 0; def->max = 1000; @@ -1857,15 +1859,6 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionString("")); - def = this->add("heated_chamber", coBool); - def->label = L("Supports heated chamber"); - def->tooltip = L("When enabled, G-codes to heat up the chamber will be emitted before and after the Start G-code (unless they are " - "explicitely used in the Start G-code).\n\nThe temperature can be configured in Filament Settings, " - "temperature for the first printing filament will be used. The chamber heating is not turned off " - "at the end, the user is supposed to do it in custom End G-code when they want it."); - def->mode = comExpert; - def->set_default_value(new ConfigOptionBool(false)); - def = this->add("remaining_times", coBool); def->label = L("Supports remaining times"); def->tooltip = L("Emit M73 P[percent printed] R[remaining time in minutes] at 1 minute" diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 323eaf96af..72ba652e5f 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -790,7 +790,6 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, parking_pos_retraction)) ((ConfigOptionBool, remaining_times)) ((ConfigOptionBool, silent_mode)) - ((ConfigOptionBool, heated_chamber)) ((ConfigOptionFloat, extra_loading_move)) ((ConfigOptionFloat, multimaterial_purging)) ((ConfigOptionString, color_change_gcode)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index dfd7f6c301..fdf0d3a339 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2385,13 +2385,6 @@ void TabFilament::toggle_options() } } - if (m_active_page->title() == "Filament") - { - bool supports_chamber = m_preset_bundle->printers.get_edited_preset().config.opt_bool("heated_chamber"); - toggle_option("chamber_temperature", supports_chamber); - toggle_option("chamber_minimal_temperature", supports_chamber); - } - if (m_active_page->title() == "Advanced") { bool multitool_ramming = m_config->opt_bool("filament_multitool_ramming", 0); @@ -2703,7 +2696,6 @@ void TabPrinter::build_fff() optgroup->append_single_option_line("silent_mode"); optgroup->append_single_option_line("remaining_times"); optgroup->append_single_option_line("binary_gcode"); - optgroup->append_single_option_line("heated_chamber"); optgroup->on_change = [this](t_config_option_key opt_key, boost::any value) { wxTheApp->CallAfter([this, opt_key, value]() {