From 5e23f7386603aae44157a7edb802e1007a8fcfeb Mon Sep 17 00:00:00 2001 From: "xun.zhang" Date: Tue, 15 Aug 2023 14:19:31 +0800 Subject: [PATCH] ENH: add protection for chamber temperature As title. Also add time for waiting chamber temp in printing time Signed-off-by: xun.zhang Change-Id: I8054080d2e8821e421a6d03222b8b25365b5977f --- src/libslic3r/GCode/GCodeProcessor.cpp | 10 ++++++++++ src/libslic3r/GCode/GCodeProcessor.hpp | 3 +++ src/libslic3r/PrintConfig.cpp | 4 +++- src/slic3r/GUI/ConfigManipulation.cpp | 26 ++++++++++++++++++++++++++ src/slic3r/GUI/ConfigManipulation.hpp | 1 + src/slic3r/GUI/Tab.cpp | 7 +++++-- 6 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 2ff3dc4ce..20b3cf689 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1793,6 +1793,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line, bool case '9': switch (cmd[3]) { case '0': { process_M190(line); break; } // Wait bed temperature + case '1': { process_M191(line); break; } // Wait chamber temperature default: break; } default: @@ -3718,6 +3719,15 @@ void GCodeProcessor::process_M190(const GCodeReader::GCodeLine& line) m_highest_bed_temp = m_highest_bed_temp < (int)new_temp ? (int)new_temp : m_highest_bed_temp; } +void GCodeProcessor::process_M191(const GCodeReader::GCodeLine& line) +{ + float chamber_temp = 0; + const float wait_chamber_temp_time = 720.0; + // BBS: when chamber_temp>40,caculate time required for heating + if (line.has_value('S', chamber_temp) && chamber_temp > 40) + simulate_st_synchronize(wait_chamber_temp_time); +} + void GCodeProcessor::process_M201(const GCodeReader::GCodeLine& line) { diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 4ee1ce700..8f1e7e60d 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -827,6 +827,9 @@ namespace Slic3r { //BBS: wait bed temperature void process_M190(const GCodeReader::GCodeLine& line); + //BBS: wait chamber temperature + void process_M191(const GCodeReader::GCodeLine& line); + // Set max printing acceleration void process_M201(const GCodeReader::GCodeLine& line); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 64dbe25d7..ca11d2481 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3183,7 +3183,9 @@ void PrintConfigDef::init_fff_params() def = this->add("chamber_temperatures", coInts); def->label = L("Chamber temperature"); def->tooltip = L("By opening chamber_temperature compensation, the heating components will operate to elevate the chamber temperature." - "This can help suppress or reduce warping for high-temperature materials and potentially lead to higher interlayer bonding strength"); + "This can help suppress or reduce warping for high-temperature materials and potentially lead to higher interlayer bonding strength." + "While for PLA, PETG, TPU, PVA and other low temperature materials, the actual chamber temperature should not be high to avoid cloggings," + "so extra chamber temperature compensation is not needed, and 0 is highly recommended"); def->sidetext = L("°C"); def->full_label = L("Chamber temperature during print.0 means do not open compensation.Don't open it for low-temperature filaments like PLA, PETG, TPU"); def->min = 0; diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 2caa3e979..0db66b49b 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -162,6 +162,32 @@ void ConfigManipulation::check_filament_max_volumetric_speed(DynamicPrintConfig } +void ConfigManipulation::check_chamber_temperature(DynamicPrintConfig* config) +{ + const static std::maprecommend_temp_map = { + {"PLA",45}, + {"PLA-CF",45}, + {"PVA",45}, + {"TPU",50}, + {"PETG",55}, + {"PETG-CF",55} + }; + bool support_chamber_temp_control=GUI::wxGetApp().preset_bundle->printers.get_selected_preset().config.opt_bool("support_chamber_temp_control"); + if (support_chamber_temp_control&&config->has("chamber_temperatures")) { + std::string filament_type = config->option("filament_type")->get_at(0); + auto iter = recommend_temp_map.find(filament_type); + if (iter!=recommend_temp_map.end()) { + if (iter->second < config->option("chamber_temperatures")->get_at(0)) { + wxString msg_text = wxString::Format(_L("Current chamber temperature is higher than the material's safe temperature,it may result in material softening and clogging.The maximum safe temperature for the material is %d"), iter->second); + MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK); + is_msg_dlg_already_exist = true; + dialog.ShowModal(); + is_msg_dlg_already_exist = false; + } + } + } +} + void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config) { // #ys_FIXME_to_delete diff --git a/src/slic3r/GUI/ConfigManipulation.hpp b/src/slic3r/GUI/ConfigManipulation.hpp index db4389d94..2d828cd8a 100644 --- a/src/slic3r/GUI/ConfigManipulation.hpp +++ b/src/slic3r/GUI/ConfigManipulation.hpp @@ -78,6 +78,7 @@ public: void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config); void check_bed_temperature_difference(int bed_type, DynamicPrintConfig* config); void check_filament_max_volumetric_speed(DynamicPrintConfig *config); + void check_chamber_temperature(DynamicPrintConfig* config); void set_is_BBL_Printer(bool is_bbl_printer) { is_BBL_Printer = is_bbl_printer; }; // SLA print void update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config = false); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 3eec357de..07f7a051a 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2698,6 +2698,9 @@ void TabFilament::build() else if (opt_key == "nozzle_temperature_initial_layer") { m_config_manipulation.check_nozzle_temperature_initial_layer_range(&filament_config); } + else if (opt_key == "chamber_temperatures") { + m_config_manipulation.check_chamber_temperature(&filament_config); + } on_value_change(opt_key, value); }; @@ -2868,7 +2871,7 @@ void TabFilament::toggle_options() toggle_option(el, has_enable_overhang_bridge_fan); bool support_air_filtration = this->m_preset_bundle->printers.get_selected_preset().config.opt_bool("support_air_filtration"); - toggle_line("activate_air_filtration",support_air_filtration); + toggle_line("activate_air_filtration",is_BBL_printer && support_air_filtration); for (auto elem : { "during_print_exhaust_fan_speed","complete_print_exhaust_fan_speed" }) toggle_line(elem, m_config->opt_bool("activate_air_filtration",0)); @@ -2886,7 +2889,7 @@ void TabFilament::toggle_options() } bool support_chamber_temp_control = this->m_preset_bundle->printers.get_selected_preset().config.opt_bool("support_chamber_temp_control"); - toggle_line("chamber_temperatures", support_chamber_temp_control); + toggle_line("chamber_temperatures", is_BBL_printer&&support_chamber_temp_control); for (auto el : {"cool_plate_temp", "cool_plate_temp_initial_layer", "eng_plate_temp", "eng_plate_temp_initial_layer", "textured_plate_temp", "textured_plate_temp_initial_layer"})