ENH: add support for chamber_temp and exhaust_fan

Support controlling chamebr temperature and exhaust fan for air filtration

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I31627ce4f8acce99e132b0436ab7dcd0bcebf81d
This commit is contained in:
xun.zhang 2023-08-01 10:14:22 +08:00 committed by Lane.Wei
parent be19c137fe
commit 9b20cad55e
11 changed files with 232 additions and 10 deletions

View file

@ -146,6 +146,25 @@ std::string GCodeWriter::set_bed_temperature(int temperature, bool wait)
return gcode.str();
}
std::string GCodeWriter::set_chamber_temperature(int temperature, bool wait)
{
std::string code, comment;
std::ostringstream gcode;
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";
}
else {
code = "M141";
comment = "set chamber_temperature";
gcode << code << " S" << temperature << ";" << comment << "\n";
}
return gcode.str();
}
std::string GCodeWriter::set_acceleration(unsigned int acceleration)
{
// Clamp the acceleration to the allowed maximum.
@ -738,6 +757,16 @@ std::string GCodeWriter::set_additional_fan(unsigned int speed)
return gcode.str();
}
std::string GCodeWriter::set_exhaust_fan( int speed,bool add_eol)
{
std::ostringstream gcode;
gcode << "M106" << " P3" << " S" << (int)(speed / 100.0 * 255);
if(add_eol)
gcode << "\n";
return gcode.str();
}
void GCodeWriter::add_object_start_labels(std::string& gcode)
{
if (!m_gcode_label_objects_start.empty()) {