PA per filament

This commit is contained in:
SoftFever 2022-11-05 14:49:37 +08:00
parent 6fb941cf4c
commit ec7a7ff1ff
6 changed files with 30 additions and 17 deletions

View file

@ -435,6 +435,11 @@ bool GCode::gcode_label_objects = true;
gcode += tcr_gcode;
check_add_eol(toolchange_gcode_str);
//SoftFever: set new PA for new filament
if (gcodegen.config().enable_pressure_advance.get_at(new_extruder_id)) {
gcode += gcodegen.writer().set_pressure_advance(gcodegen.config().pressure_advance.get_at(new_extruder_id));
}
// A phony move to the end position at the wipe tower.
gcodegen.writer().travel_to_xy(end_pos.cast<double>());
gcodegen.set_last_pos(wipe_tower_point_to_object_point(gcodegen, end_pos + plate_origin_2d));
@ -1641,19 +1646,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
if (is_bbl_printers) {
// if (print.config().spaghetti_detector.value)
file.write("M981 S1 P20000 ;open spaghetti detector\n");
file.write_format("M900 K%.3f M%0.3f ; Override pressure advance value\n",
m_config.pressure_advance.values.front(),
outer_wall_volumetric_speed / (1.75 * 1.75 / 4 * 3.14) *
m_config.pressure_advance.values.front());
} else {
if (m_config.enable_pressure_advance.value) {
if(print.config().gcode_flavor.value == gcfKlipper)
file.write_format("SET_PRESSURE_ADVANCE ADVANCE=%.3f ; Override pressure advance value\n",
m_config.pressure_advance.values.front());
else
file.write_format("M900 K%.3f ; Override pressure advance value\n",
m_config.pressure_advance.values.front());
}
}
// Do all objects for each layer.
@ -4226,6 +4218,10 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
if (m_ooze_prevention.enable)
gcode += m_ooze_prevention.post_toolchange(*this);
if (m_config.enable_pressure_advance.get_at(extruder_id)) {
gcode += m_writer.set_pressure_advance(m_config.pressure_advance.get_at(extruder_id));
}
return gcode;
}