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:
Kiss Lorand
2026-05-31 07:11:40 +03:00
committed by GitHub
parent b78d5b94dc
commit 6a26284ba6
3 changed files with 41 additions and 22 deletions

View File

@@ -1154,13 +1154,19 @@ std::string GCodeWriter::set_additional_fan(unsigned int speed)
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;
gcode << "M106" << " P3" << " S" << (int)(speed / 100.0 * 255);
if(add_eol)
gcode << "\n";
if (GCodeWriter::full_gcode_comment) {
if (speed == 0)
gcode << " ; disable exhaust fan ";
else
gcode << " ; enable exhaust fan ";
}
gcode << "\n";
return gcode.str();
}