ENH: manual setting for PA for 3-rd party printer only

Should never use these two setting for bambuPrinter.
Thanks original code from OrcaSlicer.

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: Ifda4086b71fd2ef170b044c7632d15fe2ef490fd
This commit is contained in:
salt.wei 2023-06-15 14:45:52 +08:00 committed by Lane.Wei
parent ca1facfaa0
commit 026eaf6bc4
7 changed files with 46 additions and 1 deletions

View file

@ -581,6 +581,10 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
gcode += tcr_gcode;
check_add_eol(toolchange_gcode_str);
//SoftFever: set new PA for new filament. BBS: never use for Bambu Printer
if (!gcodegen.is_BBL_Printer() && 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));
@ -1037,6 +1041,13 @@ namespace DoExport {
}
} // namespace DoExport
bool GCode::is_BBL_Printer()
{
if (m_curr_print)
return m_curr_print->is_BBL_Printer();
return false;
}
void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* result, ThumbnailsGeneratorCallback thumbnail_cb)
{
PROFILE_CLEAR();
@ -4295,6 +4306,10 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
gcode += this->placeholder_parser_process("filament_start_gcode", filament_start_gcode, extruder_id);
check_add_eol(gcode);
}
//BBS: never use for Bambu Printer
if (!this->is_BBL_Printer() && m_config.enable_pressure_advance.get_at(extruder_id))
gcode += m_writer.set_pressure_advance(m_config.pressure_advance.get_at(extruder_id));
gcode += m_writer.toolchange(extruder_id);
return gcode;
}
@ -4473,6 +4488,9 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
// Set the new extruder to the operating temperature.
if (m_ooze_prevention.enable)
gcode += m_ooze_prevention.post_toolchange(*this);
//BBS: never use for Bambu Printer
if (!this->is_BBL_Printer() && 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;
}

View file

@ -202,6 +202,8 @@ public:
bool needs_retraction(const Polyline &travel, ExtrusionRole role, LiftType &lift_type);
std::string retract(bool toolchange = false, bool is_last_retraction = false, LiftType lift_type = LiftType::SpiralLift);
std::string unretract() { return m_writer.unlift() + m_writer.unretract(); }
//BBS
bool is_BBL_Printer();
// Object and support extrusions of the same PrintObject at the same print_z.
// public, so that it could be accessed by free helper functions from GCode.cpp

View file

@ -784,7 +784,7 @@ static std::vector<std::string> s_Preset_filament_options {
"filament_wipe_distance", "additional_cooling_fan_speed",
"bed_temperature_difference", "nozzle_temperature_range_low", "nozzle_temperature_range_high",
//softfever
"chamber_temperature"
"enable_pressure_advance", "pressure_advance", "chamber_temperature"
};
static std::vector<std::string> s_Preset_machine_limits_options {

View file

@ -77,6 +77,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
//BBS: add bed_exclude_area
"bed_exclude_area",
"before_layer_change_gcode",
"enable_pressure_advance",
"pressure_advance",
"enable_overhang_bridge_fan"
"overhang_fan_speed",
"overhang_fan_threshold",

View file

@ -1136,6 +1136,18 @@ void PrintConfigDef::init_fff_params()
def->min = 0.01;
def->set_default_value(new ConfigOptionFloat(1));
def = this->add("enable_pressure_advance", coBools);
def->label = L("Enable pressure advance");
def->tooltip = L("Enable pressure advance, auto calibration result will be overwriten once enabled. Useless for Bambu Printer");
def->set_default_value(new ConfigOptionBools{ false });
def = this->add("pressure_advance", coFloats);
def->label = L("Pressure advance");
def->tooltip = L("Pressure advance(Klipper) AKA Linear advance factor(Marlin). Useless for Bambu Printer");
def->max = 2;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 0.02 });
def = this->add("line_width", coFloat);
def->label = L("Default");
def->category = L("Quality");

View file

@ -807,6 +807,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionString, machine_end_gcode))
((ConfigOptionStrings, filament_end_gcode))
((ConfigOptionFloats, filament_flow_ratio))
((ConfigOptionBools, enable_pressure_advance))
((ConfigOptionFloats, pressure_advance))
((ConfigOptionFloats, filament_diameter))
((ConfigOptionFloats, filament_density))
((ConfigOptionStrings, filament_type))

View file

@ -2606,6 +2606,8 @@ void TabFilament::build()
optgroup->append_single_option_line("default_filament_colour");
optgroup->append_single_option_line("filament_diameter");
optgroup->append_single_option_line("filament_flow_ratio");
optgroup->append_single_option_line("enable_pressure_advance");
optgroup->append_single_option_line("pressure_advance");
optgroup->append_single_option_line("filament_density");
optgroup->append_single_option_line("filament_cost");
//BBS
@ -2828,6 +2830,13 @@ void TabFilament::toggle_options()
}
if (m_active_page->title() == "Filament")
{
//BBS: hide these useless option for bambu printer
toggle_line("enable_pressure_advance", !is_BBL_printer);
if (is_BBL_printer)
toggle_line("pressure_advance", false);
else
toggle_option("pressure_advance", m_config->opt_bool("enable_pressure_advance", 0));
toggle_line("chamber_temperature", !is_BBL_printer);
}