Add Lift Z only Above/Below, On Surface (e.g. Only on Top) (#1562)

* Added config options for Enforce Lift Z (from SS, doesn't affect Gcode
yet)

* working, minus first layer override; also fixed m_last_extrusion_role not being set

* fixed logic to match SS

* minimize to just one config

* removed first layer override

* Cleaned up logic, working as intended

* added lift above z, lift below z; somehow broke filament overrides

* fixed overrides not working, but lift above/below and enforce don't override

* fixed filament overrides

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Jason M-H 2023-07-22 09:07:13 -04:00 committed by GitHub
parent 777c7c68f9
commit 7a3971eca5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 127 additions and 22 deletions

View file

@ -307,6 +307,14 @@ static const t_config_enum_values s_keys_map_ZHopType = {
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ZHopType)
static const t_config_enum_values s_keys_map_RetractLiftEnforceType = {
{"All Surfaces", rletAllSurfaces},
{"Top Only", rletTopOnly},
{"Bottom Only", rletBottomOnly},
{"Top and Bottom", rletTopAndBottom}
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(RetractLiftEnforceType)
static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology)
{
for (std::pair<const t_config_option_key, ConfigOptionDef> &kvp : options)
@ -2553,6 +2561,35 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnumsGeneric{ ZHopType::zhtNormal });
def = this->add("retract_lift_above", coFloats);
def->label = L("Only lift Z above");
def->tooltip = L("If you set this to a positive value, Z lift will only take place above the specified absolute Z.");
def->sidetext = L("mm");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{0.});
def = this->add("retract_lift_below", coFloats);
def->label = L("Only lift Z below");
def->tooltip = L("If you set this to a positive value, Z lift will only take place below the specified absolute Z.");
def->sidetext = L("mm");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{0.});
def = this->add("retract_lift_enforce", coEnums);
def->label = L("On surfaces");
def->tooltip = L("Enforce Z Hop behavior. This setting is impacted by the above settings (Only lift Z above/below).");
def->enum_keys_map = &ConfigOptionEnum<RetractLiftEnforceType>::get_enum_values();
def->enum_values.push_back("All Surfaces");
def->enum_values.push_back("Top Only");
def->enum_values.push_back("Bottom Only");
def->enum_values.push_back("Top and Bottom");
def->enum_labels.push_back(L("All Surfaces"));
def->enum_labels.push_back(L("Top Only"));
def->enum_labels.push_back(L("Bottom Only"));
def->enum_labels.push_back(L("Top and Bottom"));
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnumsGeneric{RetractLiftEnforceType ::rletAllSurfaces});
def = this->add("retract_restart_extra", coFloats);
def->label = L("Extra length on restart");
def->tooltip = L("When the retraction is compensated after the travel move, the extruder will push "
@ -3592,7 +3629,7 @@ void PrintConfigDef::init_fff_params()
// Declare retract values for filament profile, overriding the printer's extruder profile.
for (const char *opt_key : {
// floats
"retraction_length", "z_hop", "z_hop_types", "retraction_speed", "deretraction_speed", "retract_restart_extra", "retraction_minimum_travel",
"retraction_length", "z_hop", "z_hop_types", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed", "retract_restart_extra", "retraction_minimum_travel",
// BBS: floats
"wipe_distance",
// bools
@ -3639,7 +3676,7 @@ void PrintConfigDef::init_extruder_option_keys()
// ConfigOptionFloats, ConfigOptionPercents, ConfigOptionBools, ConfigOptionStrings
m_extruder_option_keys = {
"nozzle_diameter", "min_layer_height", "max_layer_height", "extruder_offset",
"retraction_length", "z_hop", "z_hop_types", "retraction_speed", "deretraction_speed",
"retraction_length", "z_hop", "z_hop_types", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed",
"retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance",
"retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour",
"default_filament_profile"
@ -3648,6 +3685,9 @@ void PrintConfigDef::init_extruder_option_keys()
m_extruder_retract_keys = {
"deretraction_speed",
"retract_before_wipe",
"retract_lift_above",
"retract_lift_below",
"retract_lift_enforce",
"retract_restart_extra",
"retract_when_changing_layer",
"retraction_length",
@ -3665,7 +3705,7 @@ void PrintConfigDef::init_filament_option_keys()
{
m_filament_option_keys = {
"filament_diameter", "min_layer_height", "max_layer_height",
"retraction_length", "z_hop", "z_hop_types", "retraction_speed", "deretraction_speed",
"retraction_length", "z_hop", "z_hop_types", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed",
"retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance",
"retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "filament_colour",
"default_filament_profile"/*,"filament_seam_gap"*/
@ -3674,6 +3714,9 @@ void PrintConfigDef::init_filament_option_keys()
m_filament_retract_keys = {
"deretraction_speed",
"retract_before_wipe",
"retract_lift_above",
"retract_lift_below",
"retract_lift_enforce",
"retract_restart_extra",
"retract_when_changing_layer",
"retraction_length",