Option for klipper only: Adjustment of "accel_to_decel" (#220)

* Klipper option: Adjustment of "accel_to_decel"

Add option to automatically adjust accel_to_decel to 50% of chosen acceleration.

* allow variable accel_to_decel percentage

allow variable accel_to_decel percentage for klipper firmware
This commit is contained in:
Patrice Côté 2023-01-24 08:33:34 -05:00 committed by GitHub
parent cdd9c51949
commit bf782028ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 9 deletions

View file

@ -174,10 +174,15 @@ std::string GCodeWriter::set_acceleration(unsigned int acceleration)
// This is new MarlinFirmware with separated print/retraction/travel acceleration.
// Use M204 P, we don't want to override travel acc by M204 S (which is deprecated anyway).
gcode << "M204 P" << acceleration;
} else {
// M204: Set default acceleration
} else if (FLAVOR_IS(gcfKlipper) && this->config.accel_to_decel_enable) {
gcode << "SET_VELOCITY_LIMIT ACCEL_TO_DECEL=" << acceleration * this->config.accel_to_decel_factor / 100;
if (GCodeWriter::full_gcode_comment)
gcode << " ; adjust max_accel_to_decel to chosen % of new accel value\n";
gcode << "M204 S" << acceleration;
}
// Set max accel to decel to half of acceleration
} else
gcode << "M204 S" << acceleration;
//BBS
if (GCodeWriter::full_gcode_comment) gcode << " ; adjust acceleration";
gcode << "\n";

View file

@ -752,7 +752,7 @@ static std::vector<std::string> s_Preset_print_options {
"small_perimeter_speed", "small_perimeter_threshold","bridge_angle", "filter_out_gap_fill", "post_process", "travel_acceleration","inner_wall_acceleration",
"default_jerk", "outer_wall_jerk", "inner_wall_jerk", "infill_jerk", "top_surface_jerk", "initial_layer_jerk","travel_jerk",
"top_solid_infill_flow_ratio","bottom_solid_infill_flow_ratio","only_one_wall_first_layer",
"print_flow_ratio","seam_gap","role_based_wipe_speed","wipe_speed"
"print_flow_ratio","seam_gap","role_based_wipe_speed","wipe_speed","accel_to_decel_enable", "accel_to_decel_factor"
};

View file

@ -103,7 +103,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"outer_wall_acceleration",
"inner_wall_acceleration",
"initial_layer_acceleration",
"outer_wall_acceleration",
"top_surface_acceleration",
"travel_acceleration",
// BBS
@ -153,7 +152,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"seam_gap",
"role_based_wipe_speed",
"wipe_speed",
"use_relative_e_distances"
"use_relative_e_distances",
"accel_to_decel_enable",
"accel_to_decel_factor"
};
static std::unordered_set<std::string> steps_ignore;

View file

@ -1168,7 +1168,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("pressure_advance", coFloats);
def->label = L("Pressure advance");
def->tooltip = L("Pressure advnce(Klipper) AKA Linear advance factor(Marlin)");
def->tooltip = L("Pressure advance(Klipper) AKA Linear advance factor(Marlin)");
def->max = 2;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats { 0.02 });
@ -1452,6 +1452,21 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(300));
def = this->add("accel_to_decel_enable", coBool);
def->label = L("Adjust accel to decel");
def->tooltip = L("Klipper's max_accel_to_decel will be adjusted automatically");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("accel_to_decel_factor", coPercent);
def->label = L("% of acceleration");
def->tooltip = L("Klipper's Max_accel_to_decel will be adjusted to this % of acceleration");
def->sidetext = L("%");
def->min = 1;
def->max = 100;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionPercent(50));
def = this->add("default_jerk", coFloat);
def->label = L("Default");
def->tooltip = L("Default");

View file

@ -854,6 +854,8 @@ PRINT_CONFIG_CLASS_DEFINE(
// SoftFever
((ConfigOptionBool, use_firmware_retraction))
((ConfigOptionBool, use_relative_e_distances))
((ConfigOptionBool, accel_to_decel_enable))
((ConfigOptionPercent, accel_to_decel_factor))
)
// This object is mapped to Perl as Slic3r::Config::Print.