Feat: chamber temp control and chamber fan (#2483)

* init

* tweak
This commit is contained in:
SoftFever
2023-10-22 16:38:20 +08:00
committed by GitHub
parent 809e6d1cc7
commit 90601c098a
11 changed files with 100 additions and 65 deletions
+31 -18
View File
@@ -2240,6 +2240,17 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
// adds tag for processor
file.write_format(";%s%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Role).c_str(), ExtrusionEntity::role_to_string(erCustom).c_str());
// Orca: set chamber temperature at the beginning of gcode file
bool activate_chamber_temp_control = false;
auto max_chamber_temp = 0;
for (const auto &extruder : m_writer.extruders()) {
activate_chamber_temp_control |= m_config.activate_chamber_temp_control.get_at(extruder.id());
max_chamber_temp = std::max(max_chamber_temp, m_config.chamber_temperature.get_at(extruder.id()));
}
if (activate_chamber_temp_control && max_chamber_temp > 0)
file.write(m_writer.set_chamber_temperature(max_chamber_temp, true)); // set chamber_temperature
// Write the custom start G-code
file.writeln(machine_start_gcode);
@@ -2262,10 +2273,19 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
*/
if (is_bbl_printers) {
this->_print_first_layer_extruder_temperatures(file, print, machine_start_gcode, initial_extruder_id, true);
if (m_config.support_air_filtration.getBool() && m_config.activate_air_filtration.get_at(initial_extruder_id)) {
file.write(m_writer.set_exhaust_fan(m_config.during_print_exhaust_fan_speed.get_at(initial_extruder_id), true));
}
}
// Orca: when activate_air_filtration is set on any extruder, find and set the highest during_print_exhaust_fan_speed
bool activate_air_filtration = false;
int during_print_exhaust_fan_speed = 0;
for (const auto &extruder : m_writer.extruders()) {
activate_air_filtration |= m_config.activate_air_filtration.get_at(extruder.id());
if (m_config.activate_air_filtration.get_at(extruder.id()))
during_print_exhaust_fan_speed = std::max(during_print_exhaust_fan_speed,
m_config.during_print_exhaust_fan_speed.get_at(extruder.id()));
}
if (activate_air_filtration)
file.write(m_writer.set_exhaust_fan(during_print_exhaust_fan_speed, true));
print.throw_if_canceled();
// Set other general things.
@@ -2528,10 +2548,16 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
file.write(m_writer.update_progress(m_layer_count, m_layer_count, true)); // 100%
file.write(m_writer.postamble());
if (print.config().support_chamber_temp_control.value || print.config().chamber_temperature.values[0] > 0)
if (activate_chamber_temp_control && max_chamber_temp > 0)
file.write(m_writer.set_chamber_temperature(0, false)); //close chamber_temperature
if (activate_air_filtration) {
int complete_print_exhaust_fan_speed = 0;
for (const auto& extruder : m_writer.extruders())
if (m_config.activate_air_filtration.get_at(extruder.id()))
complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(extruder.id()));
file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true));
}
// adds tags for time estimators
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Last_Line_M73_Placeholder).c_str());
file.write_format("; EXECUTABLE_BLOCK_END\n\n");
@@ -2581,19 +2607,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
}
file.write("\n");
bool activate_air_filtration = false;
for (const auto& extruder : m_writer.extruders())
activate_air_filtration |= m_config.activate_air_filtration.get_at(extruder.id());
activate_air_filtration &= m_config.support_air_filtration.getBool();
if (activate_air_filtration) {
int complete_print_exhaust_fan_speed = 0;
for (const auto& extruder : m_writer.extruders())
if (m_config.activate_air_filtration.get_at(extruder.id()))
complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(extruder.id()));
file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true));
}
print.throw_if_canceled();
}
+7 -3
View File
@@ -164,9 +164,13 @@ std::string GCodeWriter::set_chamber_temperature(int temperature, bool wait)
if (wait)
{
gcode<<"M106 P2 S255 \n";
gcode<<"M191 S"<<std::to_string(temperature)<<" ;"<<"set chamber_temperature and wait for it to be reached\n";
gcode<<"M106 P2 S0 \n";
// Orca: should we let the M191 command to turn on the auxiliary fan?
if (config.auxiliary_fan)
gcode << "M106 P2 S255 \n";
gcode << "M191 S" << std::to_string(temperature) << " ;"
<< "set chamber_temperature and wait for it to be reached\n";
if (config.auxiliary_fan)
gcode << "M106 P2 S0 \n";
}
else {
code = "M141";
+2 -2
View File
@@ -803,8 +803,8 @@ static std::vector<std::string> s_Preset_filament_options {
"filament_loading_speed", "filament_loading_speed_start", "filament_load_time",
"filament_unloading_speed", "filament_unloading_speed_start", "filament_unload_time", "filament_toolchange_delay", "filament_cooling_moves",
"filament_cooling_initial_speed", "filament_cooling_final_speed", "filament_ramming_parameters",
"filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow",
};
"filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow", "activate_chamber_temp_control"
};
static std::vector<std::string> s_Preset_machine_limits_options {
"machine_max_acceleration_extruding", "machine_max_acceleration_retracting", "machine_max_acceleration_travel",
+14 -7
View File
@@ -1108,7 +1108,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("activate_air_filtration",coBools);
def->label = L("Activate air filtration");
def->tooltip = L("Activate for better air filtration");
def->tooltip = L("Activate for better air filtration. G-code command: M106 P3 S(0-255)");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBools{false});
@@ -2173,7 +2173,7 @@ def = this->add("filament_loading_speed", coFloats);
def = this->add("auxiliary_fan", coBool);
def->label = L("Auxiliary part cooling fan");
def->tooltip = L("Enable this option if machine has auxiliary part cooling fan");
def->tooltip = L("Enable this option if machine has auxiliary part cooling fan. G-code command: M106 P2 S(0-255).");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
@@ -2217,18 +2217,19 @@ def = this->add("filament_loading_speed", coFloats);
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0));
// Orca: may remove this option later
def =this->add("support_chamber_temp_control",coBool);
def->label=L("Support control chamber temperature");
def->tooltip=L("This option is enabled if machine support controlling chamber temperature");
def->tooltip=L("This option is enabled if machine support controlling chamber temperature\nG-code command: M141 S(0-255)");
def->mode=comDevelop;
def->set_default_value(new ConfigOptionBool(false));
def->set_default_value(new ConfigOptionBool(true));
def->readonly=false;
def =this->add("support_air_filtration",coBool);
def->label=L("Support air filtration");
def->tooltip=L("Enable this if printer support air filtration");
def->tooltip=L("Enable this if printer support air filtration\nG-code command: M106 P3 S(0-255)");
def->mode=comDevelop;
def->set_default_value(new ConfigOptionBool(false));
def->set_default_value(new ConfigOptionBool(true));
def = this->add("gcode_flavor", coEnum);
def->label = L("G-code flavor");
@@ -2661,7 +2662,7 @@ def = this->add("filament_loading_speed", coFloats);
def = this->add("additional_cooling_fan_speed", coInts);
def->label = L("Fan speed");
def->tooltip = L("Speed of auxiliary part cooling fan. Auxiliary fan will run at this speed during printing except the first several layers "
"which is defined by no cooling layers");
"which is defined by no cooling layers.\nPlease enable auxiliary_fan in printer settings to use this feature. G-code command: M106 P2 S(0-255)");
def->sidetext = L("%");
def->min = 0;
def->max = 100;
@@ -3897,6 +3898,12 @@ def = this->add("filament_loading_speed", coFloats);
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("activate_chamber_temp_control",coBools);
def->label = L("Activate temperature control");
def->tooltip = L("Enable this option for chamber temperature control. An M191 command will be added before \"machine_start_gcode\"\nG-code commands: M141/M191 S(0-255)");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBools{false});
def = this->add("chamber_temperature", coInts);
def->label = L("Chamber temperature");
def->tooltip = L("Higher chamber temperature can help suppress or reduce warping and potentially lead to higher interlayer bonding strength for high temperature materials like ABS, ASA, PC, PA and so on."
+3 -1
View File
@@ -1087,7 +1087,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionBool, spiral_mode))
((ConfigOptionInt, standby_temperature_delta))
((ConfigOptionInts, nozzle_temperature))
((ConfigOptionInts , chamber_temperature))
((ConfigOptionBools, wipe))
// BBS
((ConfigOptionInts, nozzle_temperature_range_low))
@@ -1137,6 +1136,9 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionString, notes))
((ConfigOptionString, printer_notes))
((ConfigOptionBools, activate_chamber_temp_control))
((ConfigOptionInts , chamber_temperature))
)
+3 -8
View File
@@ -1250,14 +1250,9 @@ wxString OptionsGroup::get_url(const std::string& path_end)
anchor.Replace(L" ", "-");
str = str.Left(pos) + anchor;
}
// Softfever: point to sf wiki for seam parameters
if (path_end == "Seam") {
return wxString::Format(L"https://github.com/SoftFever/OrcaSlicer/wiki/%s", from_u8(path_end));
}
else {
//BBS
return wxString::Format(L"https://wiki.bambulab.com/%s/software/bambu-studio/%s", L"en", str);
}
// Orca: point to sf wiki for seam parameters
return wxString::Format(L"https://github.com/SoftFever/OrcaSlicer/wiki/Print-settings/%s", from_u8(path_end));
}
bool OptionsGroup::launch_browser(const std::string& path_end)
+11 -9
View File
@@ -2725,11 +2725,14 @@ void TabFilament::build()
optgroup->append_line(line);
optgroup = page->new_optgroup(L("Print temperature"), L"param_temperature");
optgroup->append_single_option_line("chamber_temperature","chamber-temperature");
optgroup = page->new_optgroup(L("Print chamber temperature"), L"param_chamber_temp");
optgroup->append_single_option_line("chamber_temperature", "chamber-temperature");
optgroup->append_single_option_line("activate_chamber_temp_control", "chamber-temperature");
optgroup->append_separator();
optgroup = page->new_optgroup(L("Print temperature"), L"param_temperature");
line = { L("Nozzle"), L("Nozzle temperature when printing") };
line.append_option(optgroup->get_option("nozzle_temperature_initial_layer"));
line.append_option(optgroup->get_option("nozzle_temperature"));
@@ -2829,11 +2832,11 @@ void TabFilament::build()
optgroup->append_single_option_line("support_material_interface_fan_speed");
optgroup = page->new_optgroup(L("Auxiliary part cooling fan"), L"param_cooling_fan");
optgroup->append_single_option_line("additional_cooling_fan_speed");
optgroup->append_single_option_line("additional_cooling_fan_speed", "auxiliary-fan");
optgroup = page->new_optgroup(L("Exhaust fan"),L"param_cooling_fan");
optgroup->append_single_option_line("activate_air_filtration");
optgroup->append_single_option_line("activate_air_filtration", "air-filtration");
line = {L("During print"), ""};
line.append_option(optgroup->get_option("during_print_exhaust_fan_speed"));
@@ -3004,8 +3007,7 @@ void TabFilament::toggle_options()
toggle_line("cool_plate_temp_initial_layer", is_BBL_printer);
toggle_line("eng_plate_temp_initial_layer", is_BBL_printer);
toggle_line("textured_plate_temp_initial_layer", is_BBL_printer);
// bool support_chamber_temp_control = this->m_preset_bundle->printers.get_selected_preset().config.opt_bool("support_chamber_temp_control");
// toggle_option("chamber_temperature", !is_BBL_printer || support_chamber_temp_control);
}
if (m_active_page->title() == L("Setting Overrides"))
update_filament_overrides_page();
@@ -3166,9 +3168,9 @@ void TabPrinter::build_fff()
optgroup = page->new_optgroup(L("Accessory") /*, L"param_accessory"*/);
optgroup->append_single_option_line("nozzle_type");
optgroup->append_single_option_line("nozzle_hrc");
optgroup->append_single_option_line("auxiliary_fan");
optgroup->append_single_option_line("support_chamber_temp_control");
optgroup->append_single_option_line("support_air_filtration");
optgroup->append_single_option_line("auxiliary_fan", "auxiliary-fan");
optgroup->append_single_option_line("support_chamber_temp_control", "chamber-temperature");
optgroup->append_single_option_line("support_air_filtration", "air-filtration");
const int gcode_field_height = 15; // 150
const int notes_field_height = 25; // 250