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 (cherry picked from commit 215878864e1410085ddf9735595e1b1cb00c1e47)
This commit is contained in:
parent
4121960292
commit
977ae079c8
|
@ -571,6 +571,15 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
|
||||||
check_add_eol(start_filament_gcode_str);
|
check_add_eol(start_filament_gcode_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deal exhaust fan speed
|
||||||
|
{
|
||||||
|
const bool activate_air_filtration = gcodegen.config().activate_air_filtration.get_at(new_extruder_id);
|
||||||
|
if (activate_air_filtration&&gcodegen.config().support_air_filtration.getBool()) {
|
||||||
|
start_filament_gcode_str += GCodeWriter::set_exhaust_fan(gcodegen.config().during_print_exhaust_fan_speed.get_at(new_extruder_id),false);
|
||||||
|
((start_filament_gcode_str +=';')+=GCodeProcessor::reserved_tag(GCodeProcessor::ETags::During_Print_Exhaust_Fan)) += '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Insert the end filament, toolchange, and start filament gcode into the generated gcode.
|
// Insert the end filament, toolchange, and start filament gcode into the generated gcode.
|
||||||
DynamicConfig config;
|
DynamicConfig config;
|
||||||
config.set_key_value("filament_end_gcode", new ConfigOptionString(end_filament_gcode_str));
|
config.set_key_value("filament_end_gcode", new ConfigOptionString(end_filament_gcode_str));
|
||||||
|
@ -1799,6 +1808,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
m_placeholder_parser.set("first_layer_center_no_wipe_tower", new ConfigOptionFloats(center.x(),center.y()));
|
m_placeholder_parser.set("first_layer_center_no_wipe_tower", new ConfigOptionFloats(center.x(),center.y()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto chamber_temp_vec = m_config.option<ConfigOptionInts>("chamber_temperatures")->values;
|
||||||
|
int max_chamber_temp = *std::max_element(chamber_temp_vec.begin(), chamber_temp_vec.end());
|
||||||
{
|
{
|
||||||
int curr_bed_type = m_config.curr_bed_type.getInt();
|
int curr_bed_type = m_config.curr_bed_type.getInt();
|
||||||
|
|
||||||
|
@ -1841,6 +1852,9 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
if (print.config().gcode_flavor != gcfKlipper) {
|
if (print.config().gcode_flavor != gcfKlipper) {
|
||||||
// Set bed temperature if the start G-code does not contain any bed temp control G-codes.
|
// Set bed temperature if the start G-code does not contain any bed temp control G-codes.
|
||||||
this->_print_first_layer_bed_temperature(file, print, machine_start_gcode, initial_extruder_id, true);
|
this->_print_first_layer_bed_temperature(file, print, machine_start_gcode, initial_extruder_id, true);
|
||||||
|
if (m_config.option<ConfigOptionBool>("chamber_temp_control")->getBool()) {
|
||||||
|
this->_print_chamber_temperature(file, print, machine_start_gcode,max_chamber_temp, true);
|
||||||
|
}
|
||||||
// Set extruder(s) temperature before and after start G-code.
|
// Set extruder(s) temperature before and after start G-code.
|
||||||
this->_print_first_layer_extruder_temperatures(file, print, machine_start_gcode, initial_extruder_id, false);
|
this->_print_first_layer_extruder_temperatures(file, print, machine_start_gcode, initial_extruder_id, false);
|
||||||
}
|
}
|
||||||
|
@ -1853,6 +1867,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
m_writer.set_current_position_clear(false);
|
m_writer.set_current_position_clear(false);
|
||||||
m_start_gcode_filament = GCodeProcessor::get_gcode_last_filament(machine_start_gcode);
|
m_start_gcode_filament = GCodeProcessor::get_gcode_last_filament(machine_start_gcode);
|
||||||
|
|
||||||
|
|
||||||
// Process filament-specific gcode.
|
// Process filament-specific gcode.
|
||||||
/* if (has_wipe_tower) {
|
/* if (has_wipe_tower) {
|
||||||
// Wipe tower will control the extruder switching, it will call the filament_start_gcode.
|
// Wipe tower will control the extruder switching, it will call the filament_start_gcode.
|
||||||
|
@ -1863,6 +1878,13 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
|
|
||||||
|
bool activate_air_filtration = *std::max_element(m_config.activate_air_filtration.values.begin(), m_config.activate_air_filtration.values.end()) && m_config.support_air_filtration.getBool();
|
||||||
|
|
||||||
|
if (activate_air_filtration && 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));
|
||||||
|
}
|
||||||
|
|
||||||
print.throw_if_canceled();
|
print.throw_if_canceled();
|
||||||
|
|
||||||
// Set other general things.
|
// Set other general things.
|
||||||
|
@ -2129,6 +2151,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.update_progress(m_layer_count, m_layer_count, true)); // 100%
|
||||||
file.write(m_writer.postamble());
|
file.write(m_writer.postamble());
|
||||||
|
|
||||||
|
file.write(m_writer.set_chamber_temperature(0, false)); //close chamber_temperature
|
||||||
|
|
||||||
|
|
||||||
|
if (activate_air_filtration) {
|
||||||
|
int complete_print_exhaust_fan_speed = 0;
|
||||||
|
for (size_t i = 0; i < m_config.activate_air_filtration.size(); ++i)
|
||||||
|
if (m_config.activate_air_filtration.get_at(i))
|
||||||
|
complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(i));
|
||||||
|
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");
|
||||||
|
@ -2393,6 +2425,16 @@ int GCode::get_bed_temperature(const int extruder_id, const bool is_first_layer,
|
||||||
return bed_temp_opt->get_at(extruder_id);
|
return bed_temp_opt->get_at(extruder_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCode::_print_chamber_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode,int chamber_temperature, bool wait)
|
||||||
|
{
|
||||||
|
int temp_by_gcode = -1;
|
||||||
|
bool temp_set_by_gcode = custom_gcode_sets_temperature(gcode, 141, 191, false, temp_by_gcode);
|
||||||
|
|
||||||
|
std::string set_chamber_temp_gcode = m_writer.set_chamber_temperature(chamber_temperature, wait);
|
||||||
|
if (!temp_set_by_gcode)
|
||||||
|
file.write(set_chamber_temp_gcode);
|
||||||
|
}
|
||||||
|
|
||||||
// Write 1st layer bed temperatures into the G-code.
|
// Write 1st layer bed temperatures into the G-code.
|
||||||
// Only do that if the start G-code does not already contain any M-code controlling an extruder temperature.
|
// Only do that if the start G-code does not already contain any M-code controlling an extruder temperature.
|
||||||
// M140 - Set Extruder Temperature
|
// M140 - Set Extruder Temperature
|
||||||
|
|
|
@ -507,6 +507,7 @@ private:
|
||||||
|
|
||||||
std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
||||||
void print_machine_envelope(GCodeOutputStream &file, Print &print);
|
void print_machine_envelope(GCodeOutputStream &file, Print &print);
|
||||||
|
void _print_chamber_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode,int chamber_temperature, bool wait);
|
||||||
void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||||
void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||||
// On the first printing layer. This flag triggers first layer speeds.
|
// On the first printing layer. This flag triggers first layer speeds.
|
||||||
|
|
|
@ -57,7 +57,8 @@ const std::vector<std::string> GCodeProcessor::Reserved_Tags = {
|
||||||
"_GP_FIRST_LINE_M73_PLACEHOLDER",
|
"_GP_FIRST_LINE_M73_PLACEHOLDER",
|
||||||
"_GP_LAST_LINE_M73_PLACEHOLDER",
|
"_GP_LAST_LINE_M73_PLACEHOLDER",
|
||||||
"_GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER",
|
"_GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER",
|
||||||
"_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER"
|
"_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER",
|
||||||
|
"_DURING_PRINT_EXHAUST_FAN"
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string GCodeProcessor::Flush_Start_Tag = " FLUSH_START";
|
const std::string GCodeProcessor::Flush_Start_Tag = " FLUSH_START";
|
||||||
|
@ -362,6 +363,12 @@ void GCodeProcessor::TimeProcessor::reset()
|
||||||
machine_limits = MachineEnvelopeConfig();
|
machine_limits = MachineEnvelopeConfig();
|
||||||
filament_load_times = 0.0f;
|
filament_load_times = 0.0f;
|
||||||
filament_unload_times = 0.0f;
|
filament_unload_times = 0.0f;
|
||||||
|
|
||||||
|
exhaust_fan_info.activate = false;
|
||||||
|
exhaust_fan_info.print_end_exhaust_fan_speed = 0;
|
||||||
|
exhaust_fan_info.print_end_exhaust_fan_time = 0;
|
||||||
|
insert_fan_control_flag = false;
|
||||||
|
|
||||||
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
|
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
|
||||||
machines[i].reset();
|
machines[i].reset();
|
||||||
}
|
}
|
||||||
|
@ -406,6 +413,14 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
||||||
return std::string(line_M73);
|
return std::string(line_M73);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto format_line_exhaust_fan_control = [](const std::string& mask,int fan_index,int percent) {
|
||||||
|
char line_fan[64] = { 0 };
|
||||||
|
sprintf(line_fan,mask.c_str(),
|
||||||
|
std::to_string(fan_index).c_str(),
|
||||||
|
std::to_string(int((percent/100.0)*255)).c_str());
|
||||||
|
return std::string(line_fan);
|
||||||
|
};
|
||||||
|
|
||||||
auto format_time_float = [](float time) {
|
auto format_time_float = [](float time) {
|
||||||
return Slic3r::float_to_string_decimal_point(time, 2);
|
return Slic3r::float_to_string_decimal_point(time, 2);
|
||||||
};
|
};
|
||||||
|
@ -516,7 +531,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
||||||
// add lines M73 to exported gcode
|
// add lines M73 to exported gcode
|
||||||
auto process_line_move = [
|
auto process_line_move = [
|
||||||
// Lambdas, mostly for string formatting, all with an empty capture block.
|
// Lambdas, mostly for string formatting, all with an empty capture block.
|
||||||
time_in_minutes, format_time_float, format_line_M73_main, format_line_M73_stop_int, format_line_M73_stop_float, time_in_last_minute,
|
time_in_minutes, format_time_float, format_line_M73_main, format_line_M73_stop_int, format_line_M73_stop_float, time_in_last_minute,format_line_exhaust_fan_control,
|
||||||
&self = std::as_const(*this),
|
&self = std::as_const(*this),
|
||||||
// Caches, to be modified
|
// Caches, to be modified
|
||||||
&g1_times_cache_it, &last_exported_main, &last_exported_stop,
|
&g1_times_cache_it, &last_exported_main, &last_exported_stop,
|
||||||
|
@ -535,6 +550,14 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
||||||
if (it != machine.g1_times_cache.end() && it->id == g1_lines_counter) {
|
if (it != machine.g1_times_cache.end() && it->id == g1_lines_counter) {
|
||||||
std::pair<int, int> to_export_main = { int(100.0f * it->elapsed_time / machine.time),
|
std::pair<int, int> to_export_main = { int(100.0f * it->elapsed_time / machine.time),
|
||||||
time_in_minutes(machine.time - it->elapsed_time) };
|
time_in_minutes(machine.time - it->elapsed_time) };
|
||||||
|
|
||||||
|
if (self.exhaust_fan_info.activate && !self.insert_fan_control_flag && machine.time - it->elapsed_time < self.exhaust_fan_info.print_end_exhaust_fan_time ) {
|
||||||
|
//insert fan
|
||||||
|
self.insert_fan_control_flag = true;
|
||||||
|
export_line += format_line_exhaust_fan_control("M106 P%s S%s ;open exhaust fan before print end \n", 3, self.exhaust_fan_info.print_end_exhaust_fan_speed);
|
||||||
|
++exported_lines_count;
|
||||||
|
}
|
||||||
|
|
||||||
if (last_exported_main[i] != to_export_main) {
|
if (last_exported_main[i] != to_export_main) {
|
||||||
export_line += format_line_M73_main(machine.line_m73_main_mask.c_str(),
|
export_line += format_line_M73_main(machine.line_m73_main_mask.c_str(),
|
||||||
to_export_main.first, to_export_main.second);
|
to_export_main.first, to_export_main.second);
|
||||||
|
@ -629,6 +652,9 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
||||||
gcode_line.insert(gcode_line.end(), it, it_end);
|
gcode_line.insert(gcode_line.end(), it, it_end);
|
||||||
if (eol) {
|
if (eol) {
|
||||||
++line_id;
|
++line_id;
|
||||||
|
// disable origin exhaust_fan_speed during print
|
||||||
|
if (insert_fan_control_flag&&gcode_line.find(reserved_tag(ETags::During_Print_Exhaust_Fan)) != std::string::npos)
|
||||||
|
gcode_line.clear();
|
||||||
|
|
||||||
gcode_line += "\n";
|
gcode_line += "\n";
|
||||||
// replace placeholder lines
|
// replace placeholder lines
|
||||||
|
@ -962,6 +988,18 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
||||||
const ConfigOptionBool* spiral_vase = config.option<ConfigOptionBool>("spiral_mode");
|
const ConfigOptionBool* spiral_vase = config.option<ConfigOptionBool>("spiral_mode");
|
||||||
if (spiral_vase != nullptr)
|
if (spiral_vase != nullptr)
|
||||||
m_spiral_vase_active = spiral_vase->value;
|
m_spiral_vase_active = spiral_vase->value;
|
||||||
|
|
||||||
|
|
||||||
|
for (size_t i = 0; i < config.activate_air_filtration.values.size(); ++i) {
|
||||||
|
if (config.activate_air_filtration.get_at(i)) {
|
||||||
|
m_exhaust_fan_info.print_end_exhaust_fan_speed = std::max(m_exhaust_fan_info.print_end_exhaust_fan_speed, config.end_print_exhaust_fan_speed.get_at(i));
|
||||||
|
m_exhaust_fan_info.print_end_exhaust_fan_time = std::max(m_exhaust_fan_info.print_end_exhaust_fan_time, config.end_print_exhaust_fan_time.get_at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ConfigOptionBools* activate_air_filtration = config.option<ConfigOptionBools>("activate_air_filtration");
|
||||||
|
if (activate_air_filtration != nullptr)
|
||||||
|
m_exhaust_fan_info.activate = *std::max_element(activate_air_filtration->values.begin(), activate_air_filtration->values.end())&&config.support_air_filtration.getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
||||||
|
@ -1459,9 +1497,11 @@ void GCodeProcessor::finalize(bool post_process)
|
||||||
m_height_compare.output();
|
m_height_compare.output();
|
||||||
m_width_compare.output();
|
m_width_compare.output();
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
|
if (post_process){
|
||||||
if (post_process)
|
//control chamber fan
|
||||||
|
m_time_processor.exhaust_fan_info = m_exhaust_fan_info;
|
||||||
m_time_processor.post_process(m_result.filename, m_result.moves, m_result.lines_ends, m_layer_id);
|
m_time_processor.post_process(m_result.filename, m_result.moves, m_result.lines_ends, m_layer_id);
|
||||||
|
}
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
m_result.time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - m_start_time).count();
|
m_result.time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - m_start_time).count();
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
@ -1897,7 +1937,7 @@ template<typename T>
|
||||||
// Legacy conversion, which is costly due to having to make a copy of the string before conversion.
|
// Legacy conversion, which is costly due to having to make a copy of the string before conversion.
|
||||||
try {
|
try {
|
||||||
assert(sv.size() < 1024);
|
assert(sv.size() < 1024);
|
||||||
assert(sv.data() != nullptr);
|
assert(sv.data() != nullptr);
|
||||||
std::string str { sv };
|
std::string str { sv };
|
||||||
size_t read = 0;
|
size_t read = 0;
|
||||||
if constexpr (std::is_same_v<T, int>)
|
if constexpr (std::is_same_v<T, int>)
|
||||||
|
|
|
@ -253,7 +253,8 @@ namespace Slic3r {
|
||||||
First_Line_M73_Placeholder,
|
First_Line_M73_Placeholder,
|
||||||
Last_Line_M73_Placeholder,
|
Last_Line_M73_Placeholder,
|
||||||
Estimated_Printing_Time_Placeholder,
|
Estimated_Printing_Time_Placeholder,
|
||||||
Total_Layer_Number_Placeholder
|
Total_Layer_Number_Placeholder,
|
||||||
|
During_Print_Exhaust_Fan
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::string& reserved_tag(ETags tag) { return Reserved_Tags[static_cast<unsigned char>(tag)]; }
|
static const std::string& reserved_tag(ETags tag) { return Reserved_Tags[static_cast<unsigned char>(tag)]; }
|
||||||
|
@ -353,6 +354,12 @@ namespace Slic3r {
|
||||||
float time() const;
|
float time() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ExhaustFanInfo {
|
||||||
|
bool activate{ false };
|
||||||
|
int print_end_exhaust_fan_speed{0};
|
||||||
|
int print_end_exhaust_fan_time{0};
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TimeMachine
|
struct TimeMachine
|
||||||
{
|
{
|
||||||
|
@ -448,6 +455,11 @@ namespace Slic3r {
|
||||||
// Additional load / unload times for a filament exchange sequence.
|
// Additional load / unload times for a filament exchange sequence.
|
||||||
float filament_load_times;
|
float filament_load_times;
|
||||||
float filament_unload_times;
|
float filament_unload_times;
|
||||||
|
|
||||||
|
// start fan x second before print complete
|
||||||
|
ExhaustFanInfo exhaust_fan_info;
|
||||||
|
mutable bool insert_fan_control_flag{false};
|
||||||
|
|
||||||
std::array<TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> machines;
|
std::array<TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> machines;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -613,7 +625,7 @@ namespace Slic3r {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GCodeReader m_parser;
|
GCodeReader m_parser;
|
||||||
|
ExhaustFanInfo m_exhaust_fan_info;
|
||||||
EUnits m_units;
|
EUnits m_units;
|
||||||
EPositioningType m_global_positioning_type;
|
EPositioningType m_global_positioning_type;
|
||||||
EPositioningType m_e_local_positioning_type;
|
EPositioningType m_e_local_positioning_type;
|
||||||
|
|
|
@ -146,6 +146,25 @@ std::string GCodeWriter::set_bed_temperature(int temperature, bool wait)
|
||||||
return gcode.str();
|
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)
|
std::string GCodeWriter::set_acceleration(unsigned int acceleration)
|
||||||
{
|
{
|
||||||
// Clamp the acceleration to the allowed maximum.
|
// Clamp the acceleration to the allowed maximum.
|
||||||
|
@ -735,6 +754,16 @@ 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::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)
|
void GCodeWriter::add_object_start_labels(std::string& gcode)
|
||||||
{
|
{
|
||||||
if (!m_gcode_label_objects_start.empty()) {
|
if (!m_gcode_label_objects_start.empty()) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
std::string postamble() const;
|
std::string postamble() const;
|
||||||
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
|
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
|
||||||
std::string set_bed_temperature(int temperature, bool wait = false);
|
std::string set_bed_temperature(int temperature, bool wait = false);
|
||||||
|
std::string set_chamber_temperature(int temperature, bool wait = false);
|
||||||
std::string set_acceleration(unsigned int acceleration);
|
std::string set_acceleration(unsigned int acceleration);
|
||||||
std::string set_pressure_advance(double pa) const;
|
std::string set_pressure_advance(double pa) const;
|
||||||
std::string set_jerk_xy(double jerk);
|
std::string set_jerk_xy(double jerk);
|
||||||
|
@ -91,6 +92,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);
|
||||||
//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 empty_object_start_str() { return m_gcode_label_objects_start.empty(); }
|
bool empty_object_start_str() { return m_gcode_label_objects_start.empty(); }
|
||||||
|
|
|
@ -821,6 +821,8 @@ static std::vector<std::string> s_Preset_filament_options {
|
||||||
"temperature_vitrification", "reduce_fan_stop_start_freq", "slow_down_for_layer_cooling", "fan_min_speed",
|
"temperature_vitrification", "reduce_fan_stop_start_freq", "slow_down_for_layer_cooling", "fan_min_speed",
|
||||||
"fan_max_speed", "enable_overhang_bridge_fan", "overhang_fan_speed", "overhang_fan_threshold", "close_fan_the_first_x_layers", "full_fan_speed_layer", "fan_cooling_layer_time", "slow_down_layer_time", "slow_down_min_speed",
|
"fan_max_speed", "enable_overhang_bridge_fan", "overhang_fan_speed", "overhang_fan_threshold", "close_fan_the_first_x_layers", "full_fan_speed_layer", "fan_cooling_layer_time", "slow_down_layer_time", "slow_down_min_speed",
|
||||||
"filament_start_gcode", "filament_end_gcode",
|
"filament_start_gcode", "filament_end_gcode",
|
||||||
|
//exhaust fan control
|
||||||
|
"activate_air_filtration","during_print_exhaust_fan_speed","end_print_exhaust_fan_speed","end_print_exhaust_fan_time","complete_print_exhaust_fan_speed",
|
||||||
// Retract overrides
|
// Retract overrides
|
||||||
"filament_retraction_length", "filament_z_hop", "filament_z_hop_types", "filament_retraction_speed", "filament_deretraction_speed", "filament_retract_restart_extra", "filament_retraction_minimum_travel",
|
"filament_retraction_length", "filament_z_hop", "filament_z_hop_types", "filament_retraction_speed", "filament_deretraction_speed", "filament_retract_restart_extra", "filament_retraction_minimum_travel",
|
||||||
"filament_retract_when_changing_layer", "filament_wipe", "filament_retract_before_wipe",
|
"filament_retract_when_changing_layer", "filament_wipe", "filament_retract_before_wipe",
|
||||||
|
@ -850,7 +852,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
||||||
"silent_mode",
|
"silent_mode",
|
||||||
// BBS
|
// BBS
|
||||||
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode", "template_custom_gcode",
|
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode", "template_custom_gcode",
|
||||||
"nozzle_type","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types",
|
"nozzle_type","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types","chamber_temp_control","support_air_filtration",
|
||||||
//OrcaSlicer
|
//OrcaSlicer
|
||||||
"host_type", "print_host", "printhost_apikey",
|
"host_type", "print_host", "printhost_apikey",
|
||||||
"print_host_webui",
|
"print_host_webui",
|
||||||
|
|
|
@ -161,7 +161,12 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
||||||
"inner_wall_acceleration",
|
"inner_wall_acceleration",
|
||||||
"sparse_infill_acceleration",
|
"sparse_infill_acceleration",
|
||||||
"exclude_object",
|
"exclude_object",
|
||||||
"use_relative_e_distances"
|
"use_relative_e_distances",
|
||||||
|
"activate_air_filtration",
|
||||||
|
"during_print_exhaust_fan_speed",
|
||||||
|
"end_print_exhaust_fan_speed",
|
||||||
|
"end_print_exhaust_fan_time",
|
||||||
|
"complete_print_exhaust_fan_speed"
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unordered_set<std::string> steps_ignore;
|
static std::unordered_set<std::string> steps_ignore;
|
||||||
|
|
|
@ -953,6 +953,47 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->set_default_value(new ConfigOptionString());
|
def->set_default_value(new ConfigOptionString());
|
||||||
def->cli = ConfigOptionDef::nocli;
|
def->cli = ConfigOptionDef::nocli;
|
||||||
|
|
||||||
|
def = this->add("activate_air_filtration",coBools);
|
||||||
|
def->label = L("Activate air filtration");
|
||||||
|
def->tooltip = L("Acivate for better air filtration");
|
||||||
|
def->mode = comSimple;
|
||||||
|
def->set_default_value(new ConfigOptionBools{false});
|
||||||
|
|
||||||
|
def = this->add("during_print_exhaust_fan_speed", coInts);
|
||||||
|
def->label = L("Fan speed");
|
||||||
|
def->tooltip=L("Speed of exhuast fan during printing.This speed will overwrite the speed in filament custom gcode");
|
||||||
|
def->sidetext = L("%");
|
||||||
|
def->min=0;
|
||||||
|
def->max=100;
|
||||||
|
def->mode = comSimple;
|
||||||
|
def->set_default_value(new ConfigOptionInts{60});
|
||||||
|
|
||||||
|
def = this->add("end_print_exhaust_fan_speed", coInts);
|
||||||
|
def->label = L("Fan speed");
|
||||||
|
def->tooltip=L("Speed of exhuast fan before printing completes");
|
||||||
|
def->sidetext = L("%");
|
||||||
|
def->min=0;
|
||||||
|
def->max=100;
|
||||||
|
def->mode = comSimple;
|
||||||
|
def->set_default_value(new ConfigOptionInts{60});
|
||||||
|
|
||||||
|
|
||||||
|
def = this->add("end_print_exhaust_fan_time", coInts);
|
||||||
|
def->label = L("Time");
|
||||||
|
def->tooltip=L("open exhuast fan x seconds before printing completes");
|
||||||
|
def->sidetext = L("s");
|
||||||
|
def->mode = comSimple;
|
||||||
|
def->set_default_value(new ConfigOptionInts{300});
|
||||||
|
|
||||||
|
def = this->add("complete_print_exhaust_fan_speed", coInts);
|
||||||
|
def->label = L("Fan speed");
|
||||||
|
def->sidetext = L("%");
|
||||||
|
def->tooltip=L("Speed of exhuast fan after printing completes");
|
||||||
|
def->min=0;
|
||||||
|
def->max=100;
|
||||||
|
def->mode = comSimple;
|
||||||
|
def->set_default_value(new ConfigOptionInts{80});
|
||||||
|
|
||||||
def = this->add("close_fan_the_first_x_layers", coInts);
|
def = this->add("close_fan_the_first_x_layers", coInts);
|
||||||
def->label = L("No cooling for the first");
|
def->label = L("No cooling for the first");
|
||||||
def->tooltip = L("Close all cooling fan for the first certain layers. Cooling fan of the first layer used to be closed "
|
def->tooltip = L("Close all cooling fan for the first certain layers. Cooling fan of the first layer used to be closed "
|
||||||
|
@ -1703,6 +1744,19 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->mode = comDevelop;
|
def->mode = comDevelop;
|
||||||
def->set_default_value(new ConfigOptionBool(false));
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
|
def =this->add("chamber_temp_control",coBool);
|
||||||
|
def->label=L("Support control chamber temperature");
|
||||||
|
def->tooltip=L("Enable this option if machine support controlling chamber temperature");
|
||||||
|
def->mode=comDevelop;
|
||||||
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
def->readonly=false;
|
||||||
|
|
||||||
|
def =this->add("support_air_filtration",coBool);
|
||||||
|
def->label=L("Support air filtration");
|
||||||
|
def->tooltip=L("Decide whether support activating air filtration");
|
||||||
|
def->mode=comDevelop;
|
||||||
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("gcode_flavor", coEnum);
|
def = this->add("gcode_flavor", coEnum);
|
||||||
def->label = L("G-code flavor");
|
def->label = L("G-code flavor");
|
||||||
def->tooltip = L("What kind of gcode the printer is compatible with");
|
def->tooltip = L("What kind of gcode the printer is compatible with");
|
||||||
|
|
|
@ -875,6 +875,8 @@ PRINT_CONFIG_CLASS_DEFINE(
|
||||||
//BBS
|
//BBS
|
||||||
((ConfigOptionEnum<NozzleType>, nozzle_type))
|
((ConfigOptionEnum<NozzleType>, nozzle_type))
|
||||||
((ConfigOptionBool, auxiliary_fan))
|
((ConfigOptionBool, auxiliary_fan))
|
||||||
|
((ConfigOptionBool, chamber_temp_control))
|
||||||
|
((ConfigOptionBool, support_air_filtration))
|
||||||
((ConfigOptionBool, accel_to_decel_enable))
|
((ConfigOptionBool, accel_to_decel_enable))
|
||||||
((ConfigOptionPercent, accel_to_decel_factor))
|
((ConfigOptionPercent, accel_to_decel_factor))
|
||||||
((ConfigOptionEnumsGeneric, extruder_type))
|
((ConfigOptionEnumsGeneric, extruder_type))
|
||||||
|
@ -911,6 +913,11 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||||
((ConfigOptionFloat, default_acceleration))
|
((ConfigOptionFloat, default_acceleration))
|
||||||
((ConfigOptionFloat, inner_wall_acceleration))
|
((ConfigOptionFloat, inner_wall_acceleration))
|
||||||
((ConfigOptionFloatOrPercent, sparse_infill_acceleration))
|
((ConfigOptionFloatOrPercent, sparse_infill_acceleration))
|
||||||
|
((ConfigOptionBools, activate_air_filtration))
|
||||||
|
((ConfigOptionInts, during_print_exhaust_fan_speed))
|
||||||
|
((ConfigOptionInts, end_print_exhaust_fan_speed))
|
||||||
|
((ConfigOptionInts, end_print_exhaust_fan_time))
|
||||||
|
((ConfigOptionInts, complete_print_exhaust_fan_speed))
|
||||||
((ConfigOptionInts, close_fan_the_first_x_layers))
|
((ConfigOptionInts, close_fan_the_first_x_layers))
|
||||||
((ConfigOptionEnum<DraftShield>, draft_shield))
|
((ConfigOptionEnum<DraftShield>, draft_shield))
|
||||||
((ConfigOptionFloat, extruder_clearance_height_to_rod))//BBs
|
((ConfigOptionFloat, extruder_clearance_height_to_rod))//BBs
|
||||||
|
|
|
@ -2746,6 +2746,22 @@ void TabFilament::build()
|
||||||
optgroup = page->new_optgroup(L("Auxiliary part cooling fan"), L"param_cooling_fan");
|
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");
|
||||||
|
|
||||||
|
optgroup = page->new_optgroup(L("Exhaust fan"));
|
||||||
|
|
||||||
|
optgroup->append_single_option_line("activate_air_filtration");
|
||||||
|
|
||||||
|
line = {L("During print"), L("")};
|
||||||
|
line.append_option(optgroup->get_option("during_print_exhaust_fan_speed"));
|
||||||
|
optgroup->append_line(line);
|
||||||
|
|
||||||
|
line = {L("End of print"), L("")};
|
||||||
|
line.append_option(optgroup->get_option("end_print_exhaust_fan_speed"));
|
||||||
|
line.append_option(optgroup->get_option("end_print_exhaust_fan_time"));
|
||||||
|
optgroup->append_line(line);
|
||||||
|
|
||||||
|
line = {L("Complete print"), L("")};
|
||||||
|
line.append_option(optgroup->get_option("complete_print_exhaust_fan_speed"));
|
||||||
|
optgroup->append_line(line);
|
||||||
//BBS
|
//BBS
|
||||||
add_filament_overrides_page();
|
add_filament_overrides_page();
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -2853,6 +2869,14 @@ void TabFilament::toggle_options()
|
||||||
bool has_enable_overhang_bridge_fan = m_config->opt_bool("enable_overhang_bridge_fan", 0);
|
bool has_enable_overhang_bridge_fan = m_config->opt_bool("enable_overhang_bridge_fan", 0);
|
||||||
for (auto el : { "overhang_fan_speed", "overhang_fan_threshold" })
|
for (auto el : { "overhang_fan_speed", "overhang_fan_threshold" })
|
||||||
toggle_option(el, has_enable_overhang_bridge_fan);
|
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");
|
||||||
|
//this->m_preset_bundle.
|
||||||
|
//toggle_line("activate_air_filtration",support_air_filtration);
|
||||||
|
//m_config;
|
||||||
|
for (auto elem : { "during_print_exhaust_fan_speed","end_print_exhaust_fan_speed","end_print_exhaust_fan_time","complete_print_exhaust_fan_speed" })
|
||||||
|
//toggle_line(elem, m_config->opt_bool("activate_air_filtration",0)&&support_air_filtration);
|
||||||
|
toggle_line(elem, m_config->opt_bool("activate_air_filtration",0));
|
||||||
|
|
||||||
}
|
}
|
||||||
if (m_active_page->title() == "Filament")
|
if (m_active_page->title() == "Filament")
|
||||||
{
|
{
|
||||||
|
@ -2864,7 +2888,7 @@ void TabFilament::toggle_options()
|
||||||
toggle_line("pressure_advance", true);
|
toggle_line("pressure_advance", true);
|
||||||
toggle_option("pressure_advance", m_config->opt_bool("enable_pressure_advance", 0));
|
toggle_option("pressure_advance", m_config->opt_bool("enable_pressure_advance", 0));
|
||||||
}
|
}
|
||||||
toggle_line("chamber_temperatures", !is_BBL_printer);
|
|
||||||
for (auto el :
|
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"})
|
{"cool_plate_temp", "cool_plate_temp_initial_layer", "eng_plate_temp", "eng_plate_temp_initial_layer", "textured_plate_temp", "textured_plate_temp_initial_layer"})
|
||||||
toggle_line(el, is_BBL_printer);
|
toggle_line(el, is_BBL_printer);
|
||||||
|
@ -3083,6 +3107,8 @@ void TabPrinter::build_fff()
|
||||||
optgroup = page->new_optgroup(L("Accessory") /*, L"param_accessory"*/);
|
optgroup = page->new_optgroup(L("Accessory") /*, L"param_accessory"*/);
|
||||||
optgroup->append_single_option_line("nozzle_type");
|
optgroup->append_single_option_line("nozzle_type");
|
||||||
optgroup->append_single_option_line("auxiliary_fan");
|
optgroup->append_single_option_line("auxiliary_fan");
|
||||||
|
optgroup->append_single_option_line("chamber_temp_control");
|
||||||
|
optgroup->append_single_option_line("support_air_filtration");
|
||||||
|
|
||||||
const int gcode_field_height = 15; // 150
|
const int gcode_field_height = 15; // 150
|
||||||
page = add_options_page(L("Machine gcode"), "cog");
|
page = add_options_page(L("Machine gcode"), "cog");
|
||||||
|
@ -3637,6 +3663,8 @@ void TabPrinter::toggle_options()
|
||||||
toggle_option("gcode_flavor", !is_BBL_printer);
|
toggle_option("gcode_flavor", !is_BBL_printer);
|
||||||
toggle_option("use_relative_e_distances", !is_BBL_printer);
|
toggle_option("use_relative_e_distances", !is_BBL_printer);
|
||||||
|
|
||||||
|
toggle_option("chamber_temp_control",!is_BBL_printer);
|
||||||
|
toggle_option("support_air_filtration",!is_BBL_printer);
|
||||||
auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
||||||
bool is_marlin_flavor = flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware;
|
bool is_marlin_flavor = flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware;
|
||||||
// Disable silent mode for non-marlin firmwares.
|
// Disable silent mode for non-marlin firmwares.
|
||||||
|
|
Loading…
Reference in New Issue