mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-12 11:37:42 +00:00
Fix air filtration gcode emitted even if not not supported by the printer (#13868)
* Fix air filtration gcode emitted even if not not supported - do not emit air filtration gcode if not supported by the printer - removed redundant "add_eol" parameter from "set_exhaust_fan()" function
This commit is contained in:
@@ -3172,18 +3172,24 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||||||
if (is_bbl_printers) {
|
if (is_bbl_printers) {
|
||||||
this->_print_first_layer_extruder_temperatures(file, print, machine_start_gcode, initial_extruder_id, true);
|
this->_print_first_layer_extruder_temperatures(file, print, machine_start_gcode, 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_during_print = false;
|
// Orca: when air filtration is supported, check if it needs to be activated during printing and set the exhaust fan speed accordingly
|
||||||
int during_print_exhaust_fan_speed = 0;
|
if (m_config.support_air_filtration.value) {
|
||||||
for (const auto &extruder : m_writer.extruders()) {
|
bool activate_air_filtration_during_print = false;
|
||||||
if (m_config.activate_air_filtration.get_at(extruder.id()) && m_config.activate_air_filtration_during_print.get_at(extruder.id())) {
|
int during_print_exhaust_fan_speed = 0;
|
||||||
activate_air_filtration_during_print = true;
|
|
||||||
during_print_exhaust_fan_speed = std::max(during_print_exhaust_fan_speed,
|
// Orca: when activate_air_filtration is set on any extruder, find and set the highest during_print_exhaust_fan_speed
|
||||||
m_config.during_print_exhaust_fan_speed.get_at(extruder.id()));
|
for (const auto &extruder : m_writer.extruders()) {
|
||||||
|
if (m_config.activate_air_filtration.get_at(extruder.id()) && m_config.activate_air_filtration_during_print.get_at(extruder.id())) {
|
||||||
|
activate_air_filtration_during_print = true;
|
||||||
|
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_during_print)
|
||||||
|
file.write(m_writer.set_exhaust_fan(during_print_exhaust_fan_speed));
|
||||||
}
|
}
|
||||||
if (activate_air_filtration_during_print)
|
|
||||||
file.write(m_writer.set_exhaust_fan(during_print_exhaust_fan_speed, true));
|
|
||||||
|
|
||||||
print.throw_if_canceled();
|
print.throw_if_canceled();
|
||||||
|
|
||||||
@@ -3482,16 +3488,23 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||||||
if (activate_chamber_temp_control && max_chamber_temp > 0)
|
if (activate_chamber_temp_control && max_chamber_temp > 0)
|
||||||
file.write(m_writer.set_chamber_temperature(0, false)); //close chamber_temperature
|
file.write(m_writer.set_chamber_temperature(0, false)); //close chamber_temperature
|
||||||
|
|
||||||
bool activate_air_filtration_on_completion = false;
|
// Orca: when air filtration is supported, check if it needs to be activated after print completion and set the exhaust fan speed accordingly
|
||||||
int complete_print_exhaust_fan_speed = 0;
|
if (m_config.support_air_filtration.value) {
|
||||||
for (const auto& extruder : m_writer.extruders()) {
|
bool activate_air_filtration_on_completion = false;
|
||||||
if (m_config.activate_air_filtration.get_at(extruder.id()) && m_config.activate_air_filtration_on_completion.get_at(extruder.id())) {
|
int complete_print_exhaust_fan_speed = 0;
|
||||||
activate_air_filtration_on_completion = true;
|
|
||||||
complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(extruder.id()));
|
// Orca: when activate_air_filtration is set on any extruder, find and set the highest complete_print_exhaust_fan_speed
|
||||||
|
for (const auto& extruder : m_writer.extruders()) {
|
||||||
|
if (m_config.activate_air_filtration.get_at(extruder.id()) && m_config.activate_air_filtration_on_completion.get_at(extruder.id())) {
|
||||||
|
activate_air_filtration_on_completion = true;
|
||||||
|
complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(extruder.id()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (activate_air_filtration_on_completion)
|
||||||
|
file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed));
|
||||||
}
|
}
|
||||||
if (activate_air_filtration_on_completion)
|
|
||||||
file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true));
|
|
||||||
// adds tags for time estimators
|
// adds tags for time estimators
|
||||||
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Last_Line_M73_Placeholder).c_str());
|
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Last_Line_M73_Placeholder).c_str());
|
||||||
file.write_format("; EXECUTABLE_BLOCK_END\n\n");
|
file.write_format("; EXECUTABLE_BLOCK_END\n\n");
|
||||||
|
|||||||
@@ -1154,13 +1154,19 @@ std::string GCodeWriter::set_additional_fan(unsigned int speed)
|
|||||||
return gcode.str();
|
return gcode.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GCodeWriter::set_exhaust_fan( int speed,bool add_eol)
|
std::string GCodeWriter::set_exhaust_fan(int speed)
|
||||||
{
|
{
|
||||||
std::ostringstream gcode;
|
std::ostringstream gcode;
|
||||||
gcode << "M106" << " P3" << " S" << (int)(speed / 100.0 * 255);
|
gcode << "M106" << " P3" << " S" << (int)(speed / 100.0 * 255);
|
||||||
|
|
||||||
if(add_eol)
|
if (GCodeWriter::full_gcode_comment) {
|
||||||
gcode << "\n";
|
if (speed == 0)
|
||||||
|
gcode << " ; disable exhaust fan ";
|
||||||
|
else
|
||||||
|
gcode << " ; enable exhaust fan ";
|
||||||
|
}
|
||||||
|
|
||||||
|
gcode << "\n";
|
||||||
return gcode.str();
|
return gcode.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
std::string set_fan(unsigned int speed) const;
|
std::string set_fan(unsigned int speed) const;
|
||||||
//BBS: set additional fan speed for BBS machine only
|
//BBS: set additional fan speed for BBS machine only
|
||||||
static std::string set_additional_fan(unsigned int speed);
|
static std::string set_additional_fan(unsigned int speed);
|
||||||
static std::string set_exhaust_fan(int speed,bool add_eol);
|
static std::string set_exhaust_fan(int speed);
|
||||||
//BBS
|
//BBS
|
||||||
void set_object_start_str(std::string start_string) { m_gcode_label_objects_start = start_string; }
|
void set_object_start_str(std::string start_string) { m_gcode_label_objects_start = start_string; }
|
||||||
bool is_object_start_str_empty() { return m_gcode_label_objects_start.empty(); }
|
bool is_object_start_str_empty() { return m_gcode_label_objects_start.empty(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user