ENH: add firmware retract for 3rd printers

1. Add firmware retract for 3rd printers. Use G10,G11

Github: #2319,#969

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: If3a3d591c249a4323a08045f3cc86ffb3e477d0e
This commit is contained in:
xun.zhang 2023-10-08 15:42:52 +08:00 committed by Lane.Wei
parent 7e0c831358
commit ae40f0fc4d
7 changed files with 87 additions and 21 deletions

View file

@ -3378,6 +3378,12 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
def = this->add("use_firmware_retraction",coBool);
def->label = L("Use firmware retraction");
def->tooltip = L("Convert the retraction moves to G10 and G11 gcode");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("wipe", coBools);
def->label = L("Wipe while retracting");
def->tooltip = L("Move nozzle along the last extrusion path when retracting to clean leaked material on nozzle. "
@ -4881,6 +4887,24 @@ std::map<std::string, std::string> validate(const FullPrintConfig &cfg, bool und
error_message.emplace("bottom_shell_layers", L("invalid value ") + std::to_string(cfg.bottom_shell_layers));
}
std::set<GCodeFlavor>with_firmware_retraction_flavor = {
gcfSmoothie,
gcfRepRapSprinter,
gcfRepRapFirmware,
gcfMarlinLegacy,
gcfMarlinFirmware,
gcfMachinekit,
gcfRepetier,
gcfKlipper
};
if (cfg.use_firmware_retraction.value && with_firmware_retraction_flavor.count(cfg.gcode_flavor.value)==0)
error_message.emplace("gcode_flavor",L("--use-firmware-retraction is only supported by Marlin, Klipper, Smoothie, RepRapFirmware, Repetier and Machinekit firmware"));
if (cfg.use_firmware_retraction.value)
for (unsigned char wipe : cfg.wipe.values)
if (wipe)
error_message.emplace("wipe",L("--use-firmware-retraction is not compatible with --wipe"));
// --gcode-flavor
if (! print_config_def.get("gcode_flavor")->has_enum_value(cfg.gcode_flavor.serialize())) {
error_message.emplace("gcode_flavor", L("invalid value ") + cfg.gcode_flavor.serialize());