mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
Emit Disable Power Loss Recovery (#11616)
* Emit Disable Power Loss Recovery Now only works if it's enabled but the goal it's to force disable it. With this change it will always emit the command for BBL or Marlin 2. Co-Authored-By: Michael Rook <54159303+michaelr0@users.noreply.github.com> * Refactor power loss recovery G-code comments * Return empty power loss recovery when no compatible printer * Update power loss recovery comments Update label and tooltip for power loss recovery * Add enum for power loss recovery mode Refactored power loss recovery configuration to use a new PowerLossRecoveryMode enum instead of a boolean. Updated GCodeWriter and related logic to handle the new enum, allowing for 'printer_configuration', 'enable', and 'disable' options. Updated config handling, legacy value conversion, and default values accordingly. * Update PrintConfig.cpp --------- Co-authored-by: Michael Rook <54159303+michaelr0@users.noreply.github.com> Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -161,6 +161,14 @@ static t_config_enum_values s_keys_map_BedTempFormula {
|
||||
};
|
||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(BedTempFormula)
|
||||
|
||||
// Orca
|
||||
static t_config_enum_values s_keys_map_PowerLossRecoveryMode {
|
||||
{ "printer_configuration", int(PowerLossRecoveryMode::PrinterConfiguration) },
|
||||
{ "enable", int(PowerLossRecoveryMode::Enable) },
|
||||
{ "disable", int(PowerLossRecoveryMode::Disable) }
|
||||
};
|
||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PowerLossRecoveryMode)
|
||||
|
||||
static t_config_enum_values s_keys_map_FuzzySkinType {
|
||||
{ "none", int(FuzzySkinType::None) },
|
||||
{ "external", int(FuzzySkinType::External) },
|
||||
@@ -3376,11 +3384,18 @@ void PrintConfigDef::init_fff_params()
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
// Orca
|
||||
def = this->add("enable_power_loss_recovery", coBool);
|
||||
def->label = L("Turn on Power Loss Recovery");
|
||||
def->tooltip = L("Enable this to insert power loss recovery commands in generated G-code.(Only for Bambu Lab printers and Marlin firmware based printers)");
|
||||
def = this->add("enable_power_loss_recovery", coEnum);
|
||||
def->label = L("Power Loss Recovery");
|
||||
def->tooltip = L("Choose how to control power loss recovery. When set to Printer configuration, the slicer will not emit power loss recovery G-code and will leave the printer's configuration unchanged. Applicable to Bambu Lab or Marlin 2 firmware based printers.");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
def->enum_keys_map = &ConfigOptionEnum<PowerLossRecoveryMode>::get_enum_values();
|
||||
def->enum_values.push_back("printer_configuration");
|
||||
def->enum_values.push_back("enable");
|
||||
def->enum_values.push_back("disable");
|
||||
def->enum_labels.push_back(L("Printer configuration"));
|
||||
def->enum_labels.push_back(L("Enable"));
|
||||
def->enum_labels.push_back(L("Disable"));
|
||||
def->set_default_value(new ConfigOptionEnum<PowerLossRecoveryMode>(PowerLossRecoveryMode::PrinterConfiguration));
|
||||
|
||||
//BBS
|
||||
// def = this->add("spaghetti_detector", coBool);
|
||||
@@ -7442,6 +7457,13 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
|
||||
else if (opt_key == "extruder_type") {
|
||||
ReplaceString(value, "DirectDrive", "Direct Drive");
|
||||
}
|
||||
else if (opt_key == "enable_power_loss_recovery") {
|
||||
if (value == "1" || boost::iequals(value, "true")) {
|
||||
value = "enable";
|
||||
} else if (value == "0" || boost::iequals(value, "false")) {
|
||||
value = "disable";
|
||||
}
|
||||
}
|
||||
else if(opt_key == "ensure_vertical_shell_thickness") {
|
||||
if(value == "1") {
|
||||
value = "ensure_all";
|
||||
|
||||
Reference in New Issue
Block a user